|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.Clock
public abstract class Clock
Jamaica Real-Time Specification for Java class Clock.
A clock provides means to determine the current time (now) with a given resolution.
Constructor Summary | |
---|---|
Clock()
Constructor to be called by subclasses of Clock. |
Method Summary | |
---|---|
abstract RelativeTime |
getEpochOffset()
getEpochOffset returns the relative time of the offset from the Epoch (1. |
static Clock |
getRealtimeClock()
getRealtimeClock returns the default RealtimeClock. |
abstract RelativeTime |
getResolution()
getResolution returns the resolution of this clock, i.e. |
abstract AbsoluteTime |
getTime()
getTime returns a newly allocated object that contains the current time of this clock. |
abstract AbsoluteTime |
getTime(AbsoluteTime time)
getTime store the current time of this clock into a previously allocated object |
abstract void |
setResolution(RelativeTime resolution)
setResolution sets the resolution of this time to the provided value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Clock()
Constructor to be called by subclasses of 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.
Method Detail |
---|
public abstract RelativeTime getEpochOffset() throws UnsupportedOperationException
getEpochOffset returns the relative time of the offset from the Epoch (1. Jan 1970, 00h00:00) for this clock. This offset is RelativeTime(0, 0) for the RealtimeClock returned by getRealtimeClock().
Throws an UnsupportedOperationException if the concept of date is not supported by this clock, e.g. if this is a clock corresponding to the CPU execution time of the VM.
UnsupportedOperationException
- if concept of date not
supported by this Clock.public static Clock getRealtimeClock()
getRealtimeClock returns the default RealtimeClock. The result is the singleton instance of this clock.
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).
The result will be located in HeapMemory.
public abstract RelativeTime getResolution()
getResolution returns the resolution of this clock, i.e. the constant time interval between two consecutive ticks.
A new object is allocated to hold the result
public abstract AbsoluteTime getTime()
getTime returns a newly allocated object that contains the current time of this clock.
Note that this time may be different from wallclock time for clocks that are not in sync with external time.
public abstract AbsoluteTime getTime(AbsoluteTime time)
getTime store the current time of this clock into a previously allocated object
Note that this time may be different from wallclock time for clocks that are not in sync with external time.
time
- An instance of AbsoluteTime to hold the result. May
be null, in this case this operation will be a NOP.
public abstract void setResolution(RelativeTime resolution)
setResolution sets the resolution of this time to the provided value.
resolution
- the new resolution.
IllegalArgumentException
- if parameter is null or
represents a negative or zero interval.
UnsupportedOperationException
- if setting of the timer is
not supported for the given system.
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |