com.j_spaces.kernel.time
Class SystemTime

java.lang.Object
  extended by com.j_spaces.kernel.time.SystemTime

public final class SystemTime
extends Object

A static system time wrapper, which will call the underlying ITimeProvider implementation.

usage:

long time = SystemTime.timeMillis();

AbsoluteTime is the default implementation of ITimeProvider. Custom time implementations can be provided by use of a system property. The value of the property should name a class implementing ITimeProvider interface.

 e.g. for applying a "relative time" provider, you can either:
 
 1. Set via System property: (recommended option)
 
        -Dcom.gs.time-provider=com.j_spaces.kernel.time.RelativeTime
 
 2. Set via container xml-tag value:
 
        <time-provider>com.j_spaces.kernel.time.RelativeTime</time-provider>
 
 

All known implementations, can be queried as follows:

  • SystemTime.isAbsoluteTime();
  • SystemTime.isRelativeTime();

  • Method Summary
    static String getTimeProviderName()
               
    static boolean isAbsoluteTime()
               
    static boolean isRelativeTime()
               
    static long timeMillis()
              Returns the time in milliseconds specified by the underlying ITimerProvider implementation.
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    timeMillis

    public static long timeMillis()
    Returns the time in milliseconds specified by the underlying ITimerProvider implementation. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the time-provider implementation and may be larger.

    Returns:
    the difference, measured in milliseconds, between the system time and lifetime of the JVM.

    getTimeProviderName

    public static String getTimeProviderName()
    Returns:
    TimeProvider class name of object representing this provider

    isRelativeTime

    public static boolean isRelativeTime()
    Returns:
    true if time-provider is of RelativeTime
    See Also:
    RelativeTime

    isAbsoluteTime

    public static boolean isAbsoluteTime()
    Returns:
    true if time-provider is of AbsoluteTime
    See Also:
    AbsoluteTime