com.timeindexing.time
Class Clock

java.lang.Object
  extended bycom.timeindexing.time.Clock

public class Clock
extends java.lang.Object

A simple wall clock class that returns AbsoluteTimestamps.


Field Summary
static Timestamp TICK
          A single tick of a clock.
static Clock time
          A publically usable clock that tells the time.
static Timestamp ZERO
          The zero point on the clock.
 
Constructor Summary
Clock()
           
 
Method Summary
 Timestamp asMicros()
          Get the current time resolved to microseconds.
 Timestamp asMillis()
          Get the current time resolved to milliseconds.
 Timestamp asNanos()
          Get the current time resolved to nanoseconds.
 Timestamp asScale(Scale scale)
          Convert a Timestamp to a specific Scale.
 Timestamp asSeconds()
          Get the current time resolved to seconds.
 Timestamp time()
          Return the current time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

time

public static final Clock time
A publically usable clock that tells the time.


TICK

public static final Timestamp TICK
A single tick of a clock. This is 1 unit of the lowest resolution that TimeIndexing can handle. In the current implementation it is 1 nanosecond.


ZERO

public static final Timestamp ZERO
The zero point on the clock.

Constructor Detail

Clock

public Clock()
Method Detail

time

public Timestamp time()
Return the current time. The Scale is the best that the platform will support naturally. Currently, Java only resolves times to milliseconds, so the Scale is MillisecondScale.


asScale

public Timestamp asScale(Scale scale)
Convert a Timestamp to a specific Scale.


asSeconds

public Timestamp asSeconds()
Get the current time resolved to seconds.


asMillis

public Timestamp asMillis()
Get the current time resolved to milliseconds.


asMicros

public Timestamp asMicros()
Get the current time resolved to microseconds.


asNanos

public Timestamp asNanos()
Get the current time resolved to nanoseconds.