com.anasoft.os.daofusion.bitemporal
Class TimeUtils

java.lang.Object
  extended by com.anasoft.os.daofusion.bitemporal.TimeUtils

public final class TimeUtils
extends java.lang.Object

Static utilities dealing with time.

This class controls the record time using a ReferenceTimeProvider. You can override the default ThreadLocalReferenceProvider implementation by calling the setReferenceProvider method upon application startup.

Author:
Erwin Vervaet, Christophe Vanfleteren, michal.jemala, vojtech.szocs
See Also:
ReferenceTimeProvider

Field Summary
static long ACTUAL_END_OF_TIME
          Timestamp value that represents N/A date.
static long END_OF_TIME
           
 
Method Summary
static void clearReference()
          Clears the reference time.
static org.joda.time.DateTime current()
          Returns the current local time (wallclock now), ignoring the reference time.
static org.joda.time.DateTime day(int day, int month, int year)
          Create a DateTime object representing given day of given month in given year.
static org.joda.time.DateTime endOfTime()
          Returns a DateTime object representing the end of time.
static org.joda.time.Interval from(org.joda.time.DateTime start)
          Returns an interval running from given start time till the end of time.
static org.joda.time.Interval fromNow()
          Returns an interval running from now till the end of time.
static org.joda.time.Interval interval(org.joda.time.DateTime start, org.joda.time.DateTime end)
          Returns a interval running for the specified period.
static boolean isReferenceSet()
          Determines whether or not a reference time has been set.
static org.joda.time.DateTime now()
          Returns the current reference time.
static org.joda.time.DateTime reference()
          Returns the reference time, or wallclock now if no reference time has been set.
static void setReference(org.joda.time.DateTime dateTime)
          Set the reference time to the specified value.
static void setReferenceProvider(ReferenceTimeProvider provider)
          Overrides the default ReferenceTimeProvider implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTUAL_END_OF_TIME

public static final long ACTUAL_END_OF_TIME
Timestamp value that represents N/A date.

See Also:
Constant Field Values

END_OF_TIME

public static final long END_OF_TIME
See Also:
Constant Field Values
Method Detail

setReferenceProvider

public static void setReferenceProvider(ReferenceTimeProvider provider)
Overrides the default ReferenceTimeProvider implementation.


isReferenceSet

public static boolean isReferenceSet()
Determines whether or not a reference time has been set.


reference

public static org.joda.time.DateTime reference()
Returns the reference time, or wallclock now if no reference time has been set.


setReference

public static void setReference(org.joda.time.DateTime dateTime)
Set the reference time to the specified value.


clearReference

public static void clearReference()
Clears the reference time.


day

public static org.joda.time.DateTime day(int day,
                                         int month,
                                         int year)
Create a DateTime object representing given day of given month in given year.


now

public static org.joda.time.DateTime now()
Returns the current reference time. If a reference time is set, it is that reference time that will be returned.

See Also:
reference()

current

public static org.joda.time.DateTime current()
Returns the current local time (wallclock now), ignoring the reference time.


endOfTime

public static org.joda.time.DateTime endOfTime()
Returns a DateTime object representing the end of time.


interval

public static org.joda.time.Interval interval(org.joda.time.DateTime start,
                                              org.joda.time.DateTime end)
Returns a interval running for the specified period. The returned interval is half-open: it includes the start time, but not the end time.


from

public static org.joda.time.Interval from(org.joda.time.DateTime start)
Returns an interval running from given start time till the end of time.

See Also:
endOfTime()

fromNow

public static org.joda.time.Interval fromNow()
Returns an interval running from now till the end of time.



Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.