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 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:
      • SafeClock
    • getLastSafeTimeMillis

      public static long getLastSafeTimeMillis()
      Returns the last "safe" time as computed by a previous call to the getSafeTimeMillis() 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 by getSafeTimeMillis()
      Returns:
      the number of milliseconds to wait, or negative if the timeout has expired
    • getTimeZone

      public static TimeZone getTimeZone(String sId)
      Gets the TimeZone 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 a TimeZone
      Returns:
      the specified TimeZone, or the GMT zone if the given ID cannot be understood.
      Since:
      Coherence 12.1.3
      See Also: