Class DateTimeUtils

java.lang.Object
org.jppf.utils.DateTimeUtils

public final class DateTimeUtils extends Object
Utility methods for date and time manipulation and conversion.
Author:
Laurent Cohen
  • Constructor Details

    • DateTimeUtils

      public DateTimeUtils()
  • Method Details

    • toMillis

      public static long toMillis(long time, TimeUnit unit)
      Convert the specified duration expressed in the specified time unit into milliseconds. If the unit is smaller than a millisecond (either TimeUnit.NANOSECONDS or TimeUnit.MICROSECONDS), the result will be rounded to the closest millisecond.
      Parameters:
      time - the duration to convert.
      unit - the unit in which the duration is expressed.
      Returns:
      the duration converted to milliseconds.
    • elapsedFrom

      public static long elapsedFrom(long startNanos)
      Return the time in miliis elapsed since the start given in nanos.
      Parameters:
      startNanos - the start value.
      Returns:
      the elapsed time coverted to millis.