Package com.biglybt.core.util
Class SystemTime
java.lang.Object
com.biglybt.core.util.SystemTime
Utility class to retrieve current system time, and catch clock backward time
changes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprivate static classprivate static classprotected static interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static List<SystemTime.ChangeListener>private static SystemTime.SystemTimeProviderprivate static List<SystemTime.TickConsumer>private static final booleanprivate static final intprivate static List<SystemTime.TickConsumer>static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longNote that this can this time can jump into the future or past due to clock adjustments use getMonotonousTime() if you need steady increasesstatic longstatic longTime that is guaranteed to grow monotonously and also ignores larger jumps into the future which might be caused by adjusting the system clock
Do not mix times retrieved by this method with normal time!static longgetOffsetTime(long offsetMS) static longLike getMonotonousTime but only updated at TIME_GRANULARITY_MILLIS intervals (not interpolated) As such it is likely to be cheaper to obtainstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic voidstatic void
-
Field Details
-
TIME_GRANULARITY_MILLIS
public static final long TIME_GRANULARITY_MILLIS- See Also:
-
STEPS_PER_SECOND
private static final int STEPS_PER_SECOND- See Also:
-
instance
-
SOD_IT_LETS_USE_HPC
private static final boolean SOD_IT_LETS_USE_HPC- See Also:
-
systemTimeConsumers
-
monotoneTimeConsumers
-
clock_change_list
-
-
Constructor Details
-
SystemTime
public SystemTime()
-
-
Method Details
-
useRawProvider
public static void useRawProvider() -
getCurrentTime
public static long getCurrentTime()Note that this can this time can jump into the future or past due to clock adjustments use getMonotonousTime() if you need steady increases- Returns:
- current system time in millisecond since epoch
-
getMonotonousTime
public static long getMonotonousTime()Time that is guaranteed to grow monotonously and also ignores larger jumps into the future which might be caused by adjusting the system clock
Do not mix times retrieved by this method with normal time!- Returns:
- the amount of real time passed since the program start in milliseconds
-
getSteppedMonotonousTime
public static long getSteppedMonotonousTime()Like getMonotonousTime but only updated at TIME_GRANULARITY_MILLIS intervals (not interpolated) As such it is likely to be cheaper to obtain- Returns:
-
getOffsetTime
public static long getOffsetTime(long offsetMS) -
registerConsumer
-
unregisterConsumer
-
registerMonotonousConsumer
-
unregisterMonotonousConsumer
-
registerClockChangeListener
-
unregisterClockChangeListener
-
getHighPrecisionCounter
public static long getHighPrecisionCounter() -
main
-