diff options
author | Simon Rettberg | 2024-04-08 16:45:14 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-04-08 16:45:14 +0200 |
commit | 0667426da99be45e55d84ee08097f8b7ecfbcb28 (patch) | |
tree | 3e3d16aead5c15b0aaef92110843f8b42a777a3d /src | |
parent | Change random numbers to make error go away (diff) | |
download | master-sync-shared-0667426da99be45e55d84ee08097f8b7ecfbcb28.tar.gz master-sync-shared-0667426da99be45e55d84ee08097f8b7ecfbcb28.tar.xz master-sync-shared-0667426da99be45e55d84ee08097f8b7ecfbcb28.zip |
[Util] add tickCount() method
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/openslx/util/Util.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/util/Util.java b/src/main/java/org/openslx/util/Util.java index f475d01..8593f80 100644 --- a/src/main/java/org/openslx/util/Util.java +++ b/src/main/java/org/openslx/util/Util.java @@ -118,9 +118,20 @@ public class Util } } + /** + * Number of seconds elapsed since 1970-01-01 UTC. + */ public static long unixTime() { return System.currentTimeMillis() / 1000; } + /** + * Monotonic tick count in milliseconds, not bound to RTC. + */ + public static long tickCount() + { + return System.nanoTime() / 1000; + } + } |