Skip to content

Commit fa538ef

Browse files
committed
JAVA-550: switch to System.nanoTime to measure elapsed time
1 parent cee1a6b commit fa538ef

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/com/mongodb/ReplicaSetStatus.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ synchronized void update(){
251251

252252
synchronized void update(Set<Node> seenNodes){
253253
try {
254-
long start = System.currentTimeMillis();
254+
long start = System.nanoTime();
255255
CommandResult res = _port.runCommand( _mongo.getDB("admin") , _isMasterCmd );
256256
boolean first = (_lastCheck == 0);
257-
_lastCheck = System.currentTimeMillis();
258-
float newPing = _lastCheck - start;
257+
_lastCheck = System.nanoTime();
258+
float newPing = (_lastCheck - start) / 1000000F;
259259
if (first)
260260
_pingTime = newPing;
261261
else

0 commit comments

Comments
 (0)