public abstract class Clock extends Object implements Chronograph
A clock provides means to determine the current time (now) with a given resolution.
Constructor and Description |
---|
Clock()
Constructor to be called by subclasses of Clock.
|
Modifier and Type | Method and Description |
---|---|
RelativeTime |
getQueryPrecision()
Obtain the precision with which time can be read, i.e., the nominal
interval between ticks.
|
RelativeTime |
getQueryPrecision(RelativeTime dest)
Obtain the precision with which time can be read, i.e., the nominal
interval between ticks.
|
static Clock |
getRealtimeClock()
Returns the default RealtimeClock.
|
abstract RelativeTime |
getResolution()
Returns the resolution of this clock, i.e.
|
abstract AbsoluteTime |
getTime()
Determines the current time.
|
abstract AbsoluteTime |
getTime(AbsoluteTime time)
Obtain the current time.
|
abstract void |
setResolution(RelativeTime resolution)
Sets the resolution of this time to the provided value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEpochOffset
public Clock()
Since this class is abstract, this constructor cannot be called from a class that is not a sub-class of Clock, it should therefore better be protected.
public static Clock getRealtimeClock()
For JamaicaVM, on systems that have a timer that is synchronized with the external world, this returns a RealtimeClock that is synchronized with the external world. On systems whose timer is not synchronized with the external world, the time of the returned RealtimeClock may be different to the time used by the external world (e.g., the epoch may start at system boot time).
public abstract RelativeTime getResolution()
public abstract AbsoluteTime getTime()
Chronograph
getTime
in interface Chronograph
AbsoluteTime
in the
current allocation context, representing the current time.
The returned object has this
its chronograph.public abstract AbsoluteTime getTime(AbsoluteTime time)
AbsoluteTime
is changed at some time between the invocation of the
method and the return of the method. This method will return an absolute
time value that represents this chronograph's notion of the absolute time.
For chronographs that do not measure calendar time, this absolute time may
not represent a wall clock time.getTime
in interface Chronograph
time
- The instance of AbsoluteTime
object which will be
updated in place.AbsoluteTime
passed as parameter, or a new
object when dest
is null
. The returned object
represents the current time and is associated with this
chronograph.public abstract void setResolution(RelativeTime resolution)
StaticIllegalArgumentException
- if parameter is null or
represents a negative or zero interval.UnsupportedOperationException
- if setting of the timer is
not supported for the given system.resolution
- the new resolution.public RelativeTime getQueryPrecision()
Chronograph
Chronograph.getQueryPrecision(RelativeTime)
with null
as an argument.getQueryPrecision
in interface Chronograph
public RelativeTime getQueryPrecision(RelativeTime dest)
Chronograph
getQueryPrecision
in interface Chronograph
dest
- is a time object in which to return the results.dest
, when dest
is not
null
, or in a newly created object otherwise.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2019 aicas GmbH. All Rights Reserved.