Class TimeHelper


  • public abstract class TimeHelper
    extends Object
    Class for providing time functionality.
    Since:
    20.06
    Author:
    cp 2000.08.02
    • Constructor Detail

      • TimeHelper

        public TimeHelper()
    • 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 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