org.LatencyUtils
Class TimeServices
java.lang.Object
org.LatencyUtils.TimeServices
public class TimeServices
- extends java.lang.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 java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
moveTimeForward
public static void moveTimeForward(long timeDeltaNsec)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
moveTimeForwardMsec
public static void moveTimeForwardMsec(long timeDeltaMsec)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
setCurrentTime
public static void setCurrentTime(long newCurrentTime)
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException