summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/os
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-08-15 06:09:02 +0200
committerSven Gothel <[email protected]>2013-08-15 06:09:02 +0200
commit77687335f7fae3727c902c678b9525e6f4631da1 (patch)
treeff12b83bc96597acc07fef71ce236a5da594bc30 /src/java/com/jogamp/common/os
parent0fa150687e97bb6768ccd7755cd69af9d30b2f1c (diff)
Platform: Add accurate currentTimeMillis() and currentTimeMicros() native methods, based on 'gettimeofday(..)'
Diffstat (limited to 'src/java/com/jogamp/common/os')
-rw-r--r--src/java/com/jogamp/common/os/Platform.java22
1 files changed, 22 insertions, 0 deletions
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 <code>gettimeofday(..)</code>.
+ * <p>
+ * This is an alternative to {@link System#currentTimeMillis()} and {@link System#nanoTime()}.
+ * While the named {@link System} methods do provide the required precision,
+ * <code>gettimeofday()</code> <i>also</i> guarantees time accuracy, i.e. update interval.
+ * </p>
+ * @see #currentTimeMicros()
+ */
+ public static native long currentTimeMillis();
+
+ /**
+ * Returns the unix based current time in microseconds, based on <code>gettimeofday(..)</code>.
+ * <p>
+ * This is an alternative to {@link System#currentTimeMillis()} and {@link System#nanoTime()}.
+ * While the named {@link System} methods do provide the required precision,
+ * <code>gettimeofday()</code> <i>also</i> guarantees time accuracy, i.e. update interval.
+ * </p>
+ * @see #currentTimeMillis()
+ */
+ public static native long currentTimeMicros();
/**
* Returns the estimated sleep jitter value in nanoseconds.