Package com.oracle.coherence.common.base
Class TimeHelper
java.lang.Object
com.oracle.coherence.common.base.TimeHelper
Class for providing time functionality.
- Since:
- 20.06
- Author:
- cp 2000.08.02
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
computeSafeWaitTime
(long ldtTimeout) compute the number of milliseconds until the specified time.static long
Returns the last "safe" time as computed by a previous call to thegetSafeTimeMillis()
method.static long
Returns a "safe" current time in milliseconds.static TimeZone
getTimeZone
(String sId) Gets theTimeZone
for the given ID.static long
Return the number of milliseconds which have elapsed since the JVM was started.
-
Constructor Details
-
TimeHelper
public TimeHelper()
-
-
Method Details
-
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:
-
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:
-
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
Gets theTimeZone
for the given ID.This method will cache returned TimeZones to avoid the contention caused by the
TimeZone.getTimeZone(String)
implementation.
-