Package com.oracle.coherence.common.base
Class TimeHelper
- java.lang.Object
-
- com.oracle.coherence.common.base.TimeHelper
-
public abstract class TimeHelper extends Object
Class for providing time functionality.- Since:
- 20.06
- Author:
- cp 2000.08.02
-
-
Constructor Summary
Constructors Constructor Description TimeHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
computeSafeWaitTime(long ldtTimeout)
compute the number of milliseconds until the specified time.static long
getLastSafeTimeMillis()
Returns the last "safe" time as computed by a previous call to thegetSafeTimeMillis()
method.static long
getSafeTimeMillis()
Returns a "safe" current time in milliseconds.static TimeZone
getTimeZone(String sId)
Gets theTimeZone
for the given ID.static long
getUpTimeMillis()
Return the number of milliseconds which have elapsed since the JVM was started.
-
-
-
Method Detail
-
getUpTimeMillis
public static long getUpTimeMillis()
Return the number of milliseconds which have elapsed since the JVM was started.- Returns:
- the number of milliseconds which have elapsed since the JVM was started
-
getSafeTimeMillis
public static long getSafeTimeMillis()
Returns a "safe" current time in milliseconds.- Returns:
- the difference, measured in milliseconds, between the corrected current time and midnight, January 1, 1970 UTC.
- See Also:
SafeClock
-
getLastSafeTimeMillis
public static long getLastSafeTimeMillis()
Returns the last "safe" time as computed by a previous call to thegetSafeTimeMillis()
method.- Returns:
- the last "safe" time in milliseconds
- See Also:
SafeClock
-
computeSafeWaitTime
public static long computeSafeWaitTime(long ldtTimeout)
compute the number of milliseconds until the specified time.Note: this method will only return zero if ldtTimeout == Long.MAX_VALUE.
- Parameters:
ldtTimeout
- the timeout as computed bygetSafeTimeMillis()
- Returns:
- the number of milliseconds to wait, or negative if the timeout has expired
-
getTimeZone
public static TimeZone getTimeZone(String sId)
Gets theTimeZone
for the given ID.This method will cache returned TimeZones to avoid the contention caused by the
TimeZone.getTimeZone(String)
implementation.- Parameters:
sId
- the ID for aTimeZone
- Returns:
- the specified
TimeZone
, or the GMT zone if the given ID cannot be understood. - Since:
- Coherence 12.1.3
- See Also:
TimeZone.getTimeZone(String)
-
-