Class SystemClock
java.lang.Object
com.complexible.common.util.concurrent.SystemClock
- All Implemented Interfaces:
Clock
- Since:
- 4.3
- Author:
- Scott Fines
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlonglonglongPut the current thread to sleep for the time specified.
-
Field Details
-
INSTANCE
-
-
Method Details
-
currentTimeMillis
public long currentTimeMillis()- Specified by:
currentTimeMillisin interfaceClock
-
currentTimeNanos
public long currentTimeNanos()- Specified by:
currentTimeNanosin interfaceClock
-
sleep
Description copied from interface:ClockPut the current thread to sleep for the time specified. Note that this may return before the time specified has expired (i.e. the thread may wake spuriously). This is why we return how much time is remaining, in the units specified.- Specified by:
sleepin interfaceClock- Parameters:
time- the amount of time to sleep for.unit- the unit time is measured in.- Returns:
- the amount of time left in the wait period (i.e. time-timeSlept).
- Throws:
InterruptedException- if the thread is interrupted during sleep.
-