Package com.helixframework.time
Class Durations
java.lang.Object
com.helixframework.time.Durations
Utility class for working with time durations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic longConverts the supplied human readable time duration into milliseconds.static StringmillisToHumanReadable(long millis) Converts the supplied milliseconds value into a human readable form like "X Days X Hours X Minutes X Seconds".static StringmillisToHumanReadable(long millis, boolean compress) Converts the supplied milliseconds value into a human-readable form like "X Days X Hours X Minutes X Seconds".static StringmillisToHumanReadableShorthand(long millis) Converts the supplied milliseconds value into a human-readable shorthand form like "X D X H X M X S".static StringmillisToHumanReadableShorthand(long millis, boolean compress) Converts the supplied milliseconds value into a human-readable shorthand form like "X D X H X M X S".static StringtoHumanReadable(Duration duration) Converts the suppliedDurationinto a human-readable form like "X Days X Hours X Minutes X Seconds".static StringtoHumanReadable(Duration duration, boolean compress) Converts the suppliedDurationinto a human readable form like "X Days X Hours X Minutes X Seconds".static StringtoHumanReadableShorthand(Duration duration) Converts the supplied milliseconds value into a human readable shorthand form like "X D X H X M X S".static StringtoHumanReadableShorthand(Duration duration, boolean compress) Converts the suppliedDurationinto a human-readable shorthand form like "X D X H X M X S".
-
Method Details
-
toHumanReadable
Converts the suppliedDurationinto a human-readable form like "X Days X Hours X Minutes X Seconds".- Parameters:
duration- duration- Returns:
- the human-readable duration
-
toHumanReadable
Converts the suppliedDurationinto a human readable form like "X Days X Hours X Minutes X Seconds". If you specify a compressed version then it will drop any of the larger timespans that are zero (i.e. "0 Days 0 Hours 10 Minutes 20 Seconds" becomes "10 Minutes 20 Seconds")- Parameters:
duration- the duration to convertcompress- if true, compresses the format- Returns:
- the human-readable duration
-
toHumanReadableShorthand
Converts the supplied milliseconds value into a human readable shorthand form like "X D X H X M X S".- Parameters:
duration- duration- Returns:
- the shorthand human-readable duration
-
toHumanReadableShorthand
Converts the suppliedDurationinto a human-readable shorthand form like "X D X H X M X S". If you specify a compressed version then it will drop any of the larger timespans that are zero (i.e. "0 D 0 H 10 M 20 S" becomes "10 M 20 S")- Parameters:
duration- the duration to convertcompress- if true, compresses the format by omitting zero-value timespans- Returns:
- a shorthand human-readable duration string
-
millisToHumanReadable
Converts the supplied milliseconds value into a human readable form like "X Days X Hours X Minutes X Seconds".- Parameters:
millis- milliseconds- Returns:
- the human-readable duration
-
millisToHumanReadable
Converts the supplied milliseconds value into a human-readable form like "X Days X Hours X Minutes X Seconds". If you specify a compressed version then it will drop any of the larger timespans that are zero (i.e. "0 Days 0 Hours 10 Minutes 20 Seconds" becomes "10 Minutes 20 Seconds").- Parameters:
millis- milliseconds to convertcompress- if true, compresses the format by omitting zero-value timespans- Returns:
- a human-readable duration string
-
millisToHumanReadableShorthand
Converts the supplied milliseconds value into a human-readable shorthand form like "X D X H X M X S".- Parameters:
millis- milliseconds- Returns:
- shorthand human-readable duration
-
millisToHumanReadableShorthand
Converts the supplied milliseconds value into a human-readable shorthand form like "X D X H X M X S". If you specify a compressed version then it will drop any of the larger timespans that are zero (i.e. "0 D 0 H 10 M 20 S" becomes "10 M 20 S").- Parameters:
millis- the milliseconds to convertcompress- if true, compresses the format by omitting zero-value timespans- Returns:
- a shorthand human-readable duration string
-
millisFromHumanReadable
Converts the supplied human readable time duration into milliseconds.- Parameters:
time- human readable time duration- Returns:
- milliseconds
-