[FIXED JENKINS-18671] Clock Difference broken on Manage Nodes page

System.nanos() returns a monotonically increasing value that is not related
to wallclock time. Use System.currentTimeMillis() instead.
This commit is contained in:
Richard Mortimer committed 2013-07-11 15:09:30 +01:00
1 parent 06c211c6b4
commit da9c2c55c1
2 files changed
+7 -4

No files matched your search

+4 -4
View File
@@ -457,7 +457,7 @@ public abstract class Slave extends Node implements Serializable {
* Capture the time on the master when this object is sent to remote, which is when
* {@link GetClockDifference1#writeReplace()} is run.
*/
private final long startTime = System.nanoTime();
private final long startTime = System.currentTimeMillis();
public GetClockDifference3 call() {
return new GetClockDifference3(startTime);
@@ -467,7 +467,7 @@ public abstract class Slave extends Node implements Serializable {
}
private static final class GetClockDifference3 implements Serializable {
private final long remoteTime = System.nanoTime();
private final long remoteTime = System.currentTimeMillis();
private final long startTime;
public GetClockDifference3(long startTime) {
@@ -475,8 +475,8 @@ public abstract class Slave extends Node implements Serializable {
}
private Object readResolve() {
long endTime = System.nanoTime();
return new ClockDifference(TimeUnit2.NANOSECONDS.toMillis((startTime + endTime)/2-remoteTime));
long endTime = System.currentTimeMillis();
return new ClockDifference((startTime + endTime)/2-remoteTime);
}
}