|
Project JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.util.TimeUtils
public final class TimeUtils
Utilities for manipulating absolute and relative times and for accelerating and decelerating time for testing purposes.
Field Summary | |
---|---|
static long |
ADAY
The number of milliseconds in a day. |
static long |
ADECEMBER
The number of milliseconds in the month of December. |
static long |
AFEBRUARY
The number of milliseconds in the month of February in a non-leap year. |
static long |
AFORTNIGHT
The number of milliseconds in a fortnight (two weeks). |
static long |
AHUNDREDTHOFASECOND
The number of milliseconds in a hundredth of a second. |
static long |
AJANUARY
The number of milliseconds in the month of January. |
static long |
AJULY
The number of milliseconds in the month of July. |
static long |
AJUNE
The number of milliseconds in the month of June. |
static long |
ALEAPFEBRUARY
The number of milliseconds in the month of February in a leap year. |
static long |
ALEAPYEAR
The number of milliseconds in a leap year. |
static long |
AMARCH
The number of milliseconds in the month of March. |
static long |
AMAY
The number of milliseconds in the month of May. |
static long |
AMILLISECOND
The number of milliseconds in a millisecond. |
static long |
AMINUTE
The number of milliseconds in a minute. |
static long |
ANAPRIL
The number of milliseconds in the month of April. |
static long |
ANAUGUST
The number of milliseconds in the month of August. |
static long |
ANHOUR
The number of milliseconds in an hour. |
static long |
ANOCTOBER
The number of milliseconds in the month of October. |
static long |
ANOVEMBER
The number of milliseconds in the month of November. |
static long |
ASECOND
The number of milliseconds in a second. |
static long |
ASEPTEMBER
The number of milliseconds in the month of September. |
static long |
ATENTHOFASECOND
The number of milliseconds in a tenth of a second. |
static long |
AWEEK
The number of milliseconds in a week. |
static long |
AYEAR
The number of milliseconds in a non-leap year. |
(package private) static long |
TIMEWARP
This odd little guy is for use in testing. it is applied anywhere the current time is used and allows modules which use timeutils to be tested through long (simulated) periods of time passing. |
(package private) static long |
WARPBEGAN
Absolute time in millis at which we began timewarping. |
(package private) static double |
WARPFACTOR
The rate at which time is warped using the auto-warper. |
static long |
ZEROMILLISECONDS
Zero milliseconds (yes its redundant). |
Method Summary | |
---|---|
static void |
autoWarp(double warpfactor)
VM Wide utility for automagically adjusting the time dialation of the time warp. |
static long |
timeNow()
Return the current time. |
static void |
timeWarp(long advanceby)
VM Wide utility for advancing the timewarp by the number of milliseconds specified. |
static long |
toAbsoluteTimeMillis(long duration)
Convert a duration into a duration expressed in milliseconds to absolute time realtive to the current real time. |
static long |
toAbsoluteTimeMillis(long duration,
long fromWhen)
Convert a duration into a duration expressed in milliseconds to absolute time realtive to the provided absolute time. |
static long |
toRelativeTimeMillis(long whence)
Convert an absolute real time in milliseconds to a duration relative to the current real time. |
static long |
toRelativeTimeMillis(long whence,
long fromWhen)
Convert an absolute real time in milliseconds to a duration relative to the current real time. |
static long |
warpedRelativeTime(long initial)
Return a time a relative time adjusted by the current warping factor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long ZEROMILLISECONDS
public static final long AMILLISECOND
public static final long AHUNDREDTHOFASECOND
public static final long ATENTHOFASECOND
public static final long ASECOND
public static final long AMINUTE
public static final long ANHOUR
public static final long ADAY
public static final long AWEEK
public static final long AFORTNIGHT
public static final long AJANUARY
public static final long AFEBRUARY
public static final long ALEAPFEBRUARY
public static final long AMARCH
public static final long ANAPRIL
public static final long AMAY
public static final long AJUNE
public static final long AJULY
public static final long ANAUGUST
public static final long ASEPTEMBER
public static final long ANOCTOBER
public static final long ANOVEMBER
public static final long ADECEMBER
public static final long AYEAR
public static final long ALEAPYEAR
static volatile long TIMEWARP
static long WARPBEGAN
static double WARPFACTOR
Method Detail |
---|
public static final long timeNow()
System.currentTimeMillis()
if the timeWarp(long)
or
autoWarp(double)
features are being used. Using
timeNow()
allows test harnesses to simulate long periods of
time passing.
public static final long toAbsoluteTimeMillis(long duration)
duration
- a time duration expressed in milliseconds.
public static final long toAbsoluteTimeMillis(long duration, long fromWhen)
duration
- a time duration expressed in milliseconds.fromWhen
- an absolute time expressed in milliseconds.
public static final long toRelativeTimeMillis(long whence)
whence
- an absolute real time expressed in milliseconds.
public static final long toRelativeTimeMillis(long whence, long fromWhen)
whence
- an absolute real time expressed in milliseconds.fromWhen
- the base time in absolute real time expressed in
milliseconds from which the relative time will be calculated.
public static final void timeWarp(long advanceby)
autoWarp(double)
.
advanceby
- Advance the timewarp by the number of milliseconds
specified.public static final void autoWarp(double warpfactor)
warpfactor
- a decimal ratio at which artifical time will pass.
public static final long warpedRelativeTime(long initial)
timeNow()
such
as Object.wait(long)
and
Socket.setSoTimeout(int)
.
|
JXTA J2SE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |