Package org.jppf.utils
Class DateTimeUtils
java.lang.Object
org.jppf.utils.DateTimeUtils
Utility methods for date and time manipulation and conversion.
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longelapsedFrom(long startNanos) Return the time in miliis elapsed since the start given in nanos.static longConvert the specified duration expressed in the specified time unit into milliseconds.
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
toMillis
Convert the specified duration expressed in the specified time unit into milliseconds. If the unit is smaller than a millisecond (eitherTimeUnit.NANOSECONDSorTimeUnit.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.
-