public final class CachedClock extends Object implements Clock
Clock
interface that tracks the time in a
private long field that is updated by a background thread once every
millisecond. Timers on most platforms do not have millisecond granularity, so
the returned value may "jump" every 10 or 16 milliseconds. To reduce this
problem, this class also updates the internal time value every 1024 calls to
currentTimeMillis()
.Modifier and Type | Method and Description |
---|---|
long |
currentTimeMillis()
Returns the value of a private long field that is updated by a background
thread once every millisecond.
|
static CachedClock |
instance() |
public static CachedClock instance()
public long currentTimeMillis()
currentTimeMillis
in interface Clock
Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.