Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public abstract class Clock

  1. Object
  2. Clock

Constructors

public Clock()

Methods

public abstract ZoneId getZone()
public abstract Instant instant()
public abstract Clock withZone(ZoneId zone)This clock, reporting its instants in zone.
public long millis()
public static Clock systemUTC()
public static Clock systemDefaultZone()
public static Clock system(ZoneId zone)The system clock, seen in zone.
public static Clock fixed(Instant fixedInstant, ZoneId zone)
public static Clock offset(Clock base, Duration offsetDuration)A clock that reads base moved on by offsetDuration.

Inherited methods

Constructor details

Clock

public Clock()

Method details

getZone

public abstract ZoneId getZone()

instant

public abstract Instant instant()

withZone

public abstract Clock withZone(ZoneId zone)
This clock, reporting its instants in zone.

millis

public long millis()

systemUTC

public static Clock systemUTC()

systemDefaultZone

public static Clock systemDefaultZone()

system

public static Clock system(ZoneId zone)
The system clock, seen in zone.

fixed

public static Clock fixed(Instant fixedInstant, ZoneId zone)

offset

public static Clock offset(Clock base, Duration offsetDuration)
A clock that reads base moved on by offsetDuration.