Package io.ably.lib.util
Class SystemClock
java.lang.Object
io.ably.lib.util.SystemClock
- All Implemented Interfaces:
Clock
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClockclockFrom(ClientOptions opts) longReturns the current wall-clock time in milliseconds since the Unix epoch (1 January 1970 00:00:00 UTC), analogous toSystem.currentTimeMillis().longnanoTime()Returns the current wall-clock time in nanoseconds since the Unix epoch (1 January 1970 00:00:00 UTC), analogous toSystem.nanoTime().Creates a newAblyTimerbacked by this clock.voidCauses the current thread to wait until either another thread callsObject.notify()/Object.notifyAll()ontarget, or the specified timeout elapses — analogous toObject.wait(long).
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
SystemClock
public SystemClock()
-
-
Method Details
-
currentTimeMillis
public long currentTimeMillis()Description copied from interface:ClockReturns the current wall-clock time in milliseconds since the Unix epoch (1 January 1970 00:00:00 UTC), analogous toSystem.currentTimeMillis().- Specified by:
-
currentTimeMillisin interfaceClock - Returns:
- current time in milliseconds
-
nanoTime
public long nanoTime()Description copied from interface:ClockReturns the current wall-clock time in nanoseconds since the Unix epoch (1 January 1970 00:00:00 UTC), analogous toSystem.nanoTime(). -
newTimer
Description copied from interface:Clock -
waitOn
Description copied from interface:ClockCauses the current thread to wait until either another thread callsObject.notify()/Object.notifyAll()ontarget, or the specified timeout elapses — analogous toObject.wait(long).The caller must hold the monitor of
targetbefore invoking this method, exactly as required byObject.wait(long).- Specified by:
-
waitOnin interfaceClock - Parameters:
-
target- the object whose monitor the current thread holds and will wait on; must not benull -
timeout- maximum time to wait in milliseconds;0means wait indefinitely - Throws:
-
InterruptedException- if the current thread is interrupted while waiting
-
clockFrom
-