Class TimeDurationFormatter
java.lang.Object
org.apache.jackrabbit.oak.commons.TimeDurationFormatter
Format a time duration as human-readable string, inspired by
Stopwatch#toString()
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeDurationFormatter
Default formatter suitable for logging (ASCII-only)Format the specified duration
-
Constructor Details
-
TimeDurationFormatter
- Parameters:
locale
- locale for formatting (affects the decimal point)threshold
- integral value that needs to be exceeded to switch to a certain time unit for display (e.g., specify2
to switch to 'days' when the elapsed time is two or more days.allowNonAscii
- set totrue
if the display unit can use the non-ASCII "micro" Unicode character
-
-
Method Details
-
forLogging
Default formatter suitable for logging (ASCII-only) -
format
Format the specified duration- Parameters:
amount
- number of time unitsunit
- time unit
-