public final class ZonalClock extends Object
Represents a clock which yields the current local time according to a timezone.
This class is immutable as long as the underlying implementations of time source and time zone are.
SystemClock.inLocalView(),
SystemClock.inZonalView(TZID)| Constructor and Description |
|---|
ZonalClock(TimeSource<?> timeSource,
String tzid)
Constructs a new clock which can yield the current local time in
given timezone.
|
ZonalClock(TimeSource<?> timeSource,
TZID tzid)
Constructs a new clock which can yield the current local time in
given timezone.
|
| Modifier and Type | Method and Description |
|---|---|
TimeSource<?> |
getSource()
Gets the associated clock.
|
TZID |
getTimezone()
Gets the associated timezone.
|
PlainTimestamp |
now()
Gets the current timestamp in the associated timezone.
|
PlainDate |
today()
Ermittelt das aktuelle Datum in der assoziierten Zeitzone.
|
public ZonalClock(TimeSource<?> timeSource, TZID tzid)
Constructs a new clock which can yield the current local time in given timezone.
Most users have no need to directly call this constructor. It is
mainly designed for being called by dedicated expressions like
SystemClock.inZonalView(tzid) etc.
timeSource - source for current world time (UTC)tzid - timezone idIllegalArgumentException - if given timezone cannot be loadedpublic ZonalClock(TimeSource<?> timeSource, String tzid)
Constructs a new clock which can yield the current local time in given timezone.
Most users have no need to directly call this constructor. It is
mainly designed for being called by dedicated expressions like
SystemClock.inZonalView(tzid) etc.
timeSource - source for current world time (UTC)tzid - timezone idIllegalArgumentException - if given timezone cannot be loadedpublic PlainTimestamp now()
Gets the current timestamp in the associated timezone.
public PlainDate today()
Ermittelt das aktuelle Datum in der assoziierten Zeitzone.
public TimeSource<?> getSource()
Gets the associated clock.
public TZID getTimezone()
Gets the associated timezone.
Copyright © 2014–2015. All rights reserved.