@Private
@Unstable
public class Timer
extends java.lang.Object
Time}, with the exception that its
functions can be overridden for dependency injection purposes.| Constructor | Description |
|---|---|
Timer() |
| Modifier and Type | Method | Description |
|---|---|---|
long |
monotonicNow() |
Current time from some arbitrary time base in the past, counting in
milliseconds, and not affected by settimeofday or similar system clock
changes.
|
long |
monotonicNowNanos() |
Same as
monotonicNow() but returns its result in nanoseconds. |
long |
now() |
Current system time.
|
public long now()
public long monotonicNow()
public long monotonicNowNanos()
monotonicNow() but returns its result in nanoseconds.
Note that this is subject to the same resolution constraints as
System.nanoTime().Copyright © 2008–2025 Apache Software Foundation. All rights reserved.