diff --git a/src/kademlia/KademliaNode.java b/src/kademlia/KademliaNode.java index 5be97b1..143ed6c 100644 --- a/src/kademlia/KademliaNode.java +++ b/src/kademlia/KademliaNode.java @@ -273,10 +273,10 @@ public class KademliaNode * */ public synchronized final void bootstrap(Node n) throws IOException, RoutingException { - long startTime = System.currentTimeMillis() / 1000L; + long startTime = System.nanoTime(); Operation op = new ConnectOperation(this.server, this, n, this.config); op.execute(); - long endTime = System.currentTimeMillis() / 1000L; + long endTime = System.nanoTime(); this.statistician.setBootstrapTime(endTime - startTime); } @@ -324,11 +324,11 @@ public class KademliaNode */ public StorageEntry get(GetParameter param) throws NoSuchElementException, IOException, ContentNotFoundException { - long startTime = System.currentTimeMillis() / 1000L; + long startTime = System.nanoTime(); if (this.dht.contains(param)) { /* If the content exist in our own DHT, then return it. */ - long endTime = System.currentTimeMillis() / 1000L; + long endTime = System.nanoTime(); this.statistician.addContentLookupTime(endTime - startTime); return this.dht.get(param); } @@ -336,7 +336,7 @@ public class KademliaNode /* Seems like it doesn't exist in our DHT, get it from other Nodes */ ContentLookupOperation clo = new ContentLookupOperation(server, this, param, this.config); clo.execute(); - long endTime = System.currentTimeMillis() / 1000L; + long endTime = System.nanoTime(); this.statistician.addContentLookupTime(endTime - startTime); return clo.getContentFound(); } diff --git a/src/kademlia/Statistician.java b/src/kademlia/Statistician.java index 21a63ec..ab6fd29 100644 --- a/src/kademlia/Statistician.java +++ b/src/kademlia/Statistician.java @@ -69,7 +69,7 @@ public class Statistician /** * Sets the bootstrap time for this Kademlia Node * - * @param time The bootstrap time in milliseconds + * @param time The bootstrap time in nanoseconds */ public void setBootstrapTime(long time) { @@ -84,7 +84,7 @@ public class Statistician /** * Add the timing for a new content lookup operation that took place * - * @param time The time the content lookup took in milliseconds + * @param time The time the content lookup took in nanoseconds */ public void addContentLookupTime(long time) {