public enum Timestamps extends Enum<Timestamps> implements TimestampProvider
TimestampProvider for different resolutions of time:
| Modifier and Type | Method and Description |
|---|---|
Timepoint |
getTime(long sinceEpoch,
TimeUnit unit)
Returns the given time as a
Timepoint based off of this timestamp provider |
Timer |
getTimer()
Returns a
Timer based on this timestamp provider |
void |
sleepFor(Duration duration)
Sleep for the given duration of time.
|
Timepoint |
sleepPast(Timepoint futureTime)
Block until the current time as returned by
TimestampProvider.getTime() is greater
than the given timepoint. |
String |
toString() |
static Timestamps |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Timestamps[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfgetTime, getUnitpublic static final Timestamps NANO
public static final Timestamps MICRO
public static final Timestamps MILLI
public static Timestamps[] values()
for (Timestamps c : Timestamps.values()) System.out.println(c);
public static Timestamps valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant
with the specified nameNullPointerException - if the argument is nullpublic Timepoint sleepPast(Timepoint futureTime) throws InterruptedException
TimestampProviderTimestampProvider.getTime() is greater
than the given timepoint.sleepPast in interface TimestampProviderfutureTime - The time to sleep pastunit argumentInterruptedException - if externally interruptedpublic void sleepFor(Duration duration) throws InterruptedException
TimestampProvidersleepFor in interface TimestampProviderInterruptedExceptionpublic Timer getTimer()
TimestampProviderTimer based on this timestamp providergetTimer in interface TimestampProviderpublic String toString()
toString in class Enum<Timestamps>public Timepoint getTime(long sinceEpoch, TimeUnit unit)
TimestampProviderTimepoint based off of this timestamp providergetTime in interface TimestampProviderCopyright © 2012–2014. All rights reserved.