Search in sources :

Example 1 with ClockDifference

use of hudson.util.ClockDifference in project hudson-2.x by hudson.

the class Slave method getClockDifference.

public ClockDifference getClockDifference() throws IOException, InterruptedException {
    VirtualChannel channel = getChannel();
    if (channel == null)
        throw new IOException(getNodeName() + " is offline");
    long startTime = System.currentTimeMillis();
    long slaveTime = channel.call(new GetSystemTime());
    long endTime = System.currentTimeMillis();
    return new ClockDifference((startTime + endTime) / 2 - slaveTime);
}
Also used : VirtualChannel(hudson.remoting.VirtualChannel) ClockDifference(hudson.util.ClockDifference) IOException(java.io.IOException)

Aggregations

VirtualChannel (hudson.remoting.VirtualChannel)1 ClockDifference (hudson.util.ClockDifference)1 IOException (java.io.IOException)1