public class CachedNanoClock extends Object implements NanoClock
NanoClock
that caches a timestamp which can be updated with update(long)
.
Instances are threadsafe with the read being volatile.
Modifier and Type | Field and Description |
---|---|
protected long |
timeNs |
Constructor and Description |
---|
CachedNanoClock() |
Modifier and Type | Method and Description |
---|---|
void |
advance(long nanos)
Advance the value of the timestamp in with release ordered semantics.
|
long |
nanoTime()
The number of ticks in nanoseconds the clock has advanced since starting.
|
void |
update(long timeNs)
Update the value of the timestamp with release memory ordered semantics.
|
public long nanoTime()
public void update(long timeNs)
timeNs
- value to update the timestamp.public void advance(long nanos)
nanos
- to advance the timestamp.Copyright © 2014-2020 Real Logic Limited. All Rights Reserved.