public interface ClockSource
Modifier and Type | Interface and Description |
---|---|
static class |
ClockSource.Factory
Factory class used to create a platform-specific ClockSource.
|
static class |
ClockSource.MillisecondClockSource |
static class |
ClockSource.NanosecondClockSource |
Modifier and Type | Field and Description |
---|---|
static ClockSource |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
long |
currentTime()
Get the current time-stamp (resolution is opaque).
|
long |
elapsedMillis(long startTime)
Convert an opaque time-stamp returned by currentTime() into an
elapsed time in milliseconds, based on the current instant in time.
|
long |
elapsedMillis(long startTime,
long endTime)
Get the difference in milliseconds between two opaque time-stamps returned
by currentTime().
|
long |
elapsedNanos(long startTime)
Convert an opaque time-stamp returned by currentTime() into an
elapsed time in milliseconds, based on the current instant in time.
|
long |
elapsedNanos(long startTime,
long endTime)
Get the difference in nanoseconds between two opaque time-stamps returned
by currentTime().
|
TimeUnit |
getSourceTimeUnit()
Get the TimeUnit the ClockSource is denominated in.
|
long |
plusMillis(long time,
long millis)
Return the specified opaque time-stamp plus the specified number of milliseconds.
|
long |
toMillis(long time)
Convert an opaque time-stamp returned by currentTime() into
milliseconds.
|
static final ClockSource INSTANCE
long currentTime()
long toMillis(long time)
time
- an opaque time-stamp returned by an instance of this classlong elapsedMillis(long startTime)
startTime
- an opaque time-stamp returned by an instance of this classlong elapsedMillis(long startTime, long endTime)
startTime
- an opaque time-stamp returned by an instance of this classendTime
- an opaque time-stamp returned by an instance of this classlong elapsedNanos(long startTime)
startTime
- an opaque time-stamp returned by an instance of this classlong elapsedNanos(long startTime, long endTime)
startTime
- an opaque time-stamp returned by an instance of this classendTime
- an opaque time-stamp returned by an instance of this classlong plusMillis(long time, long millis)
time
- an opaque time-stampmillis
- milliseconds to addTimeUnit getSourceTimeUnit()
Copyright © 2019 Zaxxer.com. All rights reserved.