Interface Clock
- All Known Implementing Classes:
SystemClock
public interface Clock
- Since:
- 4.3
- Author:
- Scott Fines
-
Method Summary
Modifier and TypeMethodDescriptionlonglonglongPut the current thread to sleep for the time specified.
-
Method Details
-
currentTimeMillis
long currentTimeMillis() -
currentTimeNanos
long currentTimeNanos() -
sleep
Put 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.- 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.
-