Class TimeUtil
- java.lang.Object
-
- io.helidon.microprofile.faulttolerance.TimeUtil
-
public class TimeUtil extends Object
Class TimeUtil.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TimeUnit
chronoUnitToTimeUnit(ChronoUnit chronoUnit)
Converts aChronoUnit
to the equivalentTimeUnit
.static long
convertToMillis(long duration, ChronoUnit chronoUnit)
Converts a duration and its chrono unit to millis.static long
convertToNanos(long duration, ChronoUnit chronoUnit)
Converts a duration and its chrono unit to nanos.static ChronoUnit
timeUnitToChronoUnit(TimeUnit timeUnit)
Converts thisTimeUnit
to the equivalentChronoUnit
.
-
-
-
Method Detail
-
chronoUnitToTimeUnit
public static TimeUnit chronoUnitToTimeUnit(ChronoUnit chronoUnit)
Converts aChronoUnit
to the equivalentTimeUnit
.- Parameters:
chronoUnit
- the ChronoUnit to convert- Returns:
- the converted equivalent TimeUnit
- Throws:
IllegalArgumentException
- ifchronoUnit
has no equivalent TimeUnitNullPointerException
- ifchronoUnit
is null
-
timeUnitToChronoUnit
public static ChronoUnit timeUnitToChronoUnit(TimeUnit timeUnit)
Converts thisTimeUnit
to the equivalentChronoUnit
.- Parameters:
timeUnit
- The TimeUnit- Returns:
- the converted equivalent ChronoUnit
- Throws:
IllegalArgumentException
- ifchronoUnit
has no equivalent TimeUnitNullPointerException
- ifchronoUnit
is null
-
convertToMillis
public static long convertToMillis(long duration, ChronoUnit chronoUnit)
Converts a duration and its chrono unit to millis.- Parameters:
duration
- The duration.chronoUnit
- The unit of the duration.- Returns:
- Milliseconds.
-
convertToNanos
public static long convertToNanos(long duration, ChronoUnit chronoUnit)
Converts a duration and its chrono unit to nanos.- Parameters:
duration
- The duration.chronoUnit
- The unit of the duration.- Returns:
- Nanoseconds.
-
-