From 77687335f7fae3727c902c678b9525e6f4631da1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 15 Aug 2013 06:09:02 +0200 Subject: Platform: Add accurate currentTimeMillis() and currentTimeMicros() native methods, based on 'gettimeofday(..)' --- src/java/com/jogamp/common/os/Platform.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/java/com/jogamp/common/os') diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 9971cf4..32fc9f4 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -434,6 +434,28 @@ public class Platform extends PlatformPropsImpl { // // time / jitter // + + /** + * Returns the unix based current time in milliseconds, based on gettimeofday(..). + *

+ * This is an alternative to {@link System#currentTimeMillis()} and {@link System#nanoTime()}. + * While the named {@link System} methods do provide the required precision, + * gettimeofday() also guarantees time accuracy, i.e. update interval. + *

+ * @see #currentTimeMicros() + */ + public static native long currentTimeMillis(); + + /** + * Returns the unix based current time in microseconds, based on gettimeofday(..). + *

+ * This is an alternative to {@link System#currentTimeMillis()} and {@link System#nanoTime()}. + * While the named {@link System} methods do provide the required precision, + * gettimeofday() also guarantees time accuracy, i.e. update interval. + *

+ * @see #currentTimeMillis() + */ + public static native long currentTimeMicros(); /** * Returns the estimated sleep jitter value in nanoseconds. -- cgit v1.2.3