Class CachedNanoClock

All Implemented Interfaces:
NanoClock

public class CachedNanoClock extends CachedNanoClockValue implements NanoClock
A NanoClock that caches a timestamp which can be updated with update(long).

Instances are threadsafe with the read being volatile.

  • Field Details

    • FIELD_UPDATER

      private static final AtomicLongFieldUpdater<CachedNanoClockValue> FIELD_UPDATER
    • p064

      byte p064
    • p065

      byte p065
    • p066

      byte p066
    • p067

      byte p067
    • p068

      byte p068
    • p069

      byte p069
    • p070

      byte p070
    • p071

      byte p071
    • p072

      byte p072
    • p073

      byte p073
    • p074

      byte p074
    • p075

      byte p075
    • p076

      byte p076
    • p077

      byte p077
    • p078

      byte p078
    • p079

      byte p079
    • p080

      byte p080
    • p081

      byte p081
    • p082

      byte p082
    • p083

      byte p083
    • p084

      byte p084
    • p085

      byte p085
    • p086

      byte p086
    • p087

      byte p087
    • p088

      byte p088
    • p089

      byte p089
    • p090

      byte p090
    • p091

      byte p091
    • p092

      byte p092
    • p093

      byte p093
    • p094

      byte p094
    • p095

      byte p095
    • p096

      byte p096
    • p097

      byte p097
    • p098

      byte p098
    • p099

      byte p099
    • p100

      byte p100
    • p101

      byte p101
    • p102

      byte p102
    • p103

      byte p103
    • p104

      byte p104
    • p105

      byte p105
    • p106

      byte p106
    • p107

      byte p107
    • p108

      byte p108
    • p109

      byte p109
    • p110

      byte p110
    • p111

      byte p111
    • p112

      byte p112
    • p113

      byte p113
    • p114

      byte p114
    • p115

      byte p115
    • p116

      byte p116
    • p117

      byte p117
    • p118

      byte p118
    • p119

      byte p119
    • p120

      byte p120
    • p121

      byte p121
    • p122

      byte p122
    • p123

      byte p123
    • p124

      byte p124
    • p125

      byte p125
    • p126

      byte p126
    • p127

      byte p127
  • Constructor Details

    • CachedNanoClock

      public CachedNanoClock()
  • Method Details

    • nanoTime

      public long nanoTime()
      The number of ticks in nanoseconds the clock has advanced since starting.

      This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents nanoseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative). The same origin is used by all invocations of this method in an instance of a Java virtual machine; other virtual machine instances are likely to use a different origin.

      Specified by:
      nanoTime in interface NanoClock
      Returns:
      number of ticks in nanoseconds the clock has advanced since starting.
      See Also:
    • update

      public void update(long timeNs)
      Update the value of the timestamp with release memory ordered semantics.
      Parameters:
      timeNs - value to update the timestamp.
    • advance

      public void advance(long nanos)
      Advance the value of the timestamp in with release ordered semantics.
      Parameters:
      nanos - to advance the timestamp.