public class ClockUtil extends Object
Constructor and Description |
---|
ClockUtil() |
Modifier and Type | Method and Description |
---|---|
static Date |
getCurrentTime() |
static Date |
now() |
static Date |
offset(Long offsetInMillis)
Moves the clock by the given offset and keeps it running from that point
on.
|
static void |
reset() |
static Date |
resetClock() |
static void |
setCurrentTime(Date currentTime)
Freezes the clock to a specified Date that will be returned by
now() and getCurrentTime() |
public static void setCurrentTime(Date currentTime)
now()
and getCurrentTime()
currentTime
- the Date to freeze the clock atpublic static void reset()
public static Date getCurrentTime()
public static Date now()
public static Date offset(Long offsetInMillis)
offsetInMillis
- the offset to move the clock bypublic static Date resetClock()
Copyright © 2021. All rights reserved.