Modifier and Type | Field and Description |
---|---|
static long |
DAY_IN_HOURS
Constant for the number of hours per day: 24.
|
static long |
HOUR_IN_MINUTES
Constant for the number of minutes per hour: 60.
|
static long |
MINUTE_IN_SECONDS
Constant for the number of seconds per minute: 60.
|
static long |
SECOND_IN_MILLIS
Constant for the number of milliseconds per second: 1000.
|
static long |
WEEK_IN_DAYS
Constant for the number of days per week: 7.
|
Constructor and Description |
---|
TimeUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
exponentialBackoffSleep(int attempt)
Sleep for an exponentially backing off amount of time, in milliseconds.
|
static void |
exponentialBackoffSleep(int attempt,
int timeunit)
Sleep for an exponentially backing off amount of time.
|
static String |
readableTimeInterval(long millis)
Method for translating a time in milliseconds to a human readable String.
|
public static final long SECOND_IN_MILLIS
public static final long MINUTE_IN_SECONDS
public static final long HOUR_IN_MINUTES
public static final long DAY_IN_HOURS
public static final long WEEK_IN_DAYS
public TimeUtils()
public static void exponentialBackoffSleep(int attempt)
attempt
- The attempt number, which is the log2 of the number of milliseconds spent asleep.public static void exponentialBackoffSleep(int attempt, int timeunit)
attempt
- The attempt number, which is the log2 of the number of timeunits spent asleep.timeunit
- the specified timeunit in milisecondsArgumentNotValid
- if timeunit is unsupported.public static String readableTimeInterval(long millis)
millis
- The amount of milliseconds.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.