From 0667426da99be45e55d84ee08097f8b7ecfbcb28 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 8 Apr 2024 16:45:14 +0200 Subject: [Util] add tickCount() method --- src/main/java/org/openslx/util/Util.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; + } + } -- cgit v1.2.3-55-g7522