public class TimerUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
mockNow
UNIT TESTS ONLY.
|
| Constructor and Description |
|---|
TimerUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
formatTimeDifference(long diff)
Format a time difference (duration) in a human-readable format.
|
static void |
formatTimeDifference(long diff,
java.lang.StringBuilder b)
Utility method for formatting a time difference (maybe this should go to a util class?)
|
static java.lang.String |
formatTimeSince(long startTime)
Format the amount of time that has elapsed since the argument time.
|
static java.time.Instant |
mockableNow()
A wrapper for
Instant.now() that allows for mocking a particular time. |
public static boolean mockNow
public static java.time.Instant mockableNow()
Instant.now() that allows for mocking a particular time.public static void formatTimeDifference(long diff,
java.lang.StringBuilder b)
diff - Time difference in millisecondsb - The string builder to append topublic static java.lang.String formatTimeDifference(long diff)
diff - The difference in milliseconds between two timestamps.public static java.lang.String formatTimeSince(long startTime)
startTime - The time we started measuring from.