提交 da9c2c55 编写于 作者: R Richard Mortimer

[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.
上级 06c211c6
......@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Clock Difference broken on Manage Nodes page
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18671">issue 18671</a>)
<li class=bug>
Fixed another possible cause of an NPE from MatrixConfiguration.newBuild.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17728">issue 17728</a>)
......
......@@ -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);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册