Package org.apache.camel.util
Class TimeUtils
- java.lang.Object
-
- org.apache.camel.util.TimeUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isPositive(Duration dur)
static String
printDuration(long uptime)
Prints the duration in a human readable format as X days Y hours Z minutes etc.static String
printDuration(long uptime, boolean precise)
Prints the duration in a human readable format as X days Y hours Z minutes etc.static String
printDuration(Duration uptime)
static Duration
toDuration(String source)
static long
toMilliSeconds(String source)
-
-
-
Method Detail
-
isPositive
public static boolean isPositive(Duration dur)
-
printDuration
public static String printDuration(Duration uptime)
-
printDuration
public static String printDuration(long uptime)
Prints the duration in a human readable format as X days Y hours Z minutes etc.- Parameters:
uptime
- the uptime in millis- Returns:
- the time used for displaying on screen or in logs
-
printDuration
public static String printDuration(long uptime, boolean precise)
Prints the duration in a human readable format as X days Y hours Z minutes etc.- Parameters:
uptime
- the uptime in millisprecise
- whether to be precise and include all details including milli seconds- Returns:
- the time used for displaying on screen or in logs
-
toDuration
public static Duration toDuration(String source) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
toMilliSeconds
public static long toMilliSeconds(String source) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-