com.j_spaces.kernel.time
Class RelativeTime
java.lang.Object
com.j_spaces.kernel.time.RelativeTime
- All Implemented Interfaces:
- ITimeProvider
public final class RelativeTime
- extends Object
- implements ITimeProvider
ITimeProvider implementation specifying a precise
timer, which is not influenced by motions of the wall-clock time.
This class contains methods related to millisecond-precision timing,
particularly via the timeMillis()
method. To measure time
accurately, this method uses java.sun.Perf
(since
JDK1.4.2). The resolution of the timer is machine dependent.
Limitations:
sun.misc.Perf is not part of the core distribution, so there is no
guarantee it will be present in future releases. More likely wont be present
in JVMs distributed by other manufacturers.
Relative Time is currently limited to Windows OS.
Relative time is currently limited to in-memory space.
Constructor Summary |
RelativeTime()
Returns a RelativeTime instance based on sun.misc.Perf precision. |
Method Summary |
long |
timeMillis()
Returns the current value of the most precise available system timer, in
milliseconds. |
RelativeTime
public RelativeTime()
- Returns a RelativeTime instance based on sun.misc.Perf precision.
- Throws:
RuntimeException
- if failed to access to sun.misc.perf
timeMillis
public long timeMillis()
- Returns the current value of the most precise available system timer, in
milliseconds. This method is used to measure elapsed time and is not
related to any other notion of system or wall-clock time.
- Specified by:
timeMillis
in interface ITimeProvider
- Returns:
- The current value of the system timer, in milliseconds.