org.LatencyUtils
Class TimeServices
java.lang.Object
org.LatencyUtils.TimeServices
public class TimeServices
- extends Object
Provide an API for time-related service, such as getting the current time and waiting for
a given period of time. By default, these services are provided by actual time services
in the JDK (i.e. System.nanoTime(), System.currentTimeMillis(), Thread.sleep(), and
java.util.concurrent.locks.LockSupport.parkNanos()). However, if the property
LatencyUtils.useActualTime is set to "false", TimeServers will only move the notion
of time in response to calls to the #setCurrentTime() method.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
useActualTime
public static final boolean useActualTime
TimeServices
public TimeServices()
nanoTime
public static long nanoTime()
currentTimeMillis
public static long currentTimeMillis()
sleepMsecs
public static void sleepMsecs(long sleepTimeMsec)
sleepNanos
public static void sleepNanos(long sleepTimeNsec)
waitUntilTime
public static void waitUntilTime(long timeToWakeAt)
throws InterruptedException
- Throws:
InterruptedException
moveTimeForward
public static void moveTimeForward(long timeDeltaNsec)
throws InterruptedException
- Throws:
InterruptedException
moveTimeForwardMsec
public static void moveTimeForwardMsec(long timeDeltaMsec)
throws InterruptedException
- Throws:
InterruptedException
setCurrentTime
public static void setCurrentTime(long newCurrentTime)
throws InterruptedException
- Throws:
InterruptedException
Copyright © 2014. All rights reserved.