Class Clock
- java.lang.Object
-
- com.jogamp.common.os.Clock
-
public class Clock extends Object
-
-
Constructor Summary
Constructors Constructor Description Clock()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
currentNanos()
Returns current monotonic nanoseconds since start of this application.static long
currentTimeMillis()
Returns current monotonic time in milliseconds.static java.time.Instant
getMonotonicNanos()
Returns the Instant presentation of monotoniccurrentNanos()
.static java.time.Instant
getMonotonicStartupTime()
Returns the monotonic startup time since module startup as used incurrentNanos()
andgetMonotonicNanos()
.static java.time.Instant
getMonotonicTime()
Returns current monotonic time since Unix Epoch `00:00:00 UTC on 1970-01-01`.static java.time.Instant
getWallClockTime()
Returns current wall-clock real-time since Unix Epoch `00:00:00 UTC on 1970-01-01`.static long
wallClockSeconds()
Returns current wall-clock system `time of day` in seconds since Unix Epoch `00:00:00 UTC on 1 January 1970`.
-
-
-
Method Detail
-
getMonotonicTime
public static java.time.Instant getMonotonicTime()
Returns current monotonic time since Unix Epoch `00:00:00 UTC on 1970-01-01`.Returned timespec is passing machine precision and range of the underlying native API.
Monotonic time shall be used for high-performance measurements of durations, since the underlying OS shall support fast calls.
Note that
currentNanos()
andgetMonotonicNanos()
perform much better than this method, since they only return one long nanosecond value since module startup.
The implementation of this method needs to write two long values into an array.
-
getWallClockTime
public static java.time.Instant getWallClockTime()
Returns current wall-clock real-time since Unix Epoch `00:00:00 UTC on 1970-01-01`.Returned Instant is passing machine precision and range of the underlying native API.
Wall-Clock time shall be used for accurate measurements of the actual time only, since the underlying OS unlikely supports fast calls.
-
getMonotonicStartupTime
public static java.time.Instant getMonotonicStartupTime()
Returns the monotonic startup time since module startup as used incurrentNanos()
andgetMonotonicNanos()
.- See Also:
currentNanos()
,getMonotonicNanos()
-
currentNanos
public static long currentNanos()
Returns current monotonic nanoseconds since start of this application.Monotonic time shall be used for high-performance measurements of durations, since the underlying OS shall support fast calls.
The returned nanoseconds are counted not from Unix Epoch but start of this module, hence it lasts for 9'223'372'036 seconds or 292 years using the 64-bit type `long`.
Method name doesn't include the term `Time` intentionally, since the returned value represent the nanoseconds duration since module start.
- See Also:
getMonotonicStartupTime()
,getMonotonicNanos()
-
getMonotonicNanos
public static java.time.Instant getMonotonicNanos()
Returns the Instant presentation of monotoniccurrentNanos()
.Monotonic time shall be used for high-performance measurements of durations, since the underlying OS shall support fast calls.
The returned nanoseconds are counted not from Unix Epoch but start of this module, hence it lasts for 9'223'372'036 seconds or 292 years using the 64-bit type `long`.
Method name doesn't include the term `Time` intentionally, since the returned value represent the nanoseconds duration since module start.
- See Also:
getMonotonicStartupTime()
,currentNanos()
-
currentTimeMillis
public static long currentTimeMillis()
Returns current monotonic time in milliseconds.
-
wallClockSeconds
public static long wallClockSeconds()
Returns current wall-clock system `time of day` in seconds since Unix Epoch `00:00:00 UTC on 1 January 1970`.
-
-