Clock

object Clock
Companion:
class
class Object
trait Matchable
class Any
Clock.type

Type members

Classlikes

class Anchored extends Clock

Clock implementation that creates an anchor between the time sources used by System.nanoTime and System.currentTimeMillis to create Instant instances that properly reflect the current system time (as is always the case with System.currentTimeMillis) but with better performance characteristics, given that the current Instant can be derived using a call to System.nanoTime, which is considerably faster.

Clock implementation that creates an anchor between the time sources used by System.nanoTime and System.currentTimeMillis to create Instant instances that properly reflect the current system time (as is always the case with System.currentTimeMillis) but with better performance characteristics, given that the current Instant can be derived using a call to System.nanoTime, which is considerably faster.

Value members

Concrete methods

def nanosBetween(left: Instant, right: Instant): Long

Returns the number of nanoseconds between two instants.

Returns the number of nanoseconds between two instants.

def nextAlignedInstant(from: Instant, bucketSize: Duration): Instant

Returns the next Instant that aligns with the provided bucket size duration. For example, if this function is called with an instant of 11:34:02 AM and a bucket size of 20 seconds, the returned Instant will be 11:34:20 AM, which is the next Instant that perfectly aligns with 20 second bucket boundaries from the EPOCH.

Returns the next Instant that aligns with the provided bucket size duration. For example, if this function is called with an instant of 11:34:02 AM and a bucket size of 20 seconds, the returned Instant will be 11:34:20 AM, which is the next Instant that perfectly aligns with 20 second bucket boundaries from the EPOCH.

def toEpochMicros(instant: Instant): Long

Returns the number of microseconds between the EPOCH and the provided instant.

Returns the number of microseconds between the EPOCH and the provided instant.