Class RealtimeClock

  extended byjavax.realtime.Clock
      extended byjavax.realtime.RealtimeClock

public class RealtimeClock
extends Clock

The class RealtimeClock provides access to the "Wall-Clock" time. In the current implementation the resolution of the clock is of the order of microseconds.

Implementation Note: This class is implemented by using the method call gettimeofday, so it has a resolution that depends on the resolution guaranteed by the underlying OS. If you need to make real fine grain time measurement than you should use that class HighResolutionClock. This class provide nanosecond time accuracy in most plaform.

Angelo Corsaro
See Also:

Constructor Summary
Method Summary
 RelativeTime getResolution()
          Return the resolution of the clock -- the interval between ticks.
 void getTime(AbsoluteTime time)
          Return the current time in an existing object.
static RealtimeClock instance()
 void setResolution(RelativeTime resolution)
          Set the resolution of this.
Methods inherited from class javax.realtime.Clock
absolute, absolute, getRealtimeClock, getTime, relative, relative
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public RealtimeClock()
Method Detail


public static RealtimeClock instance()


public RelativeTime getResolution()
Return the resolution of the clock -- the interval between ticks.

Specified by:
getResolution in class Clock
A RelativeTime object representing the resolution of this.


public void setResolution(RelativeTime resolution)
Set the resolution of this. For some hardwhere clocks setting resolution impossible and if called on those nothing happens.

Implementation Note: If the requested resolution overceeds the one obtainable by the underlying hardware this method guarantees that the finest resolution possible is set.

Specified by:
setResolution in class Clock
resolution - The new resolution of this.


public void getTime(AbsoluteTime time)
Return the current time in an existing object. The time represented by the given AbsoluteTime is changed some time between the invocation of the method and the return of the method.

Specified by:
getTime in class Clock
time - The AbsoluteTime object which will have its time changed.

jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2005 Angelo Corsaro and Morgan Deters.