diff options
author | Sven Gothel <[email protected]> | 2023-03-06 10:28:32 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-06 10:28:32 +0100 |
commit | 717bc406e96fbff30cf02adad019cf9daa14e59c (patch) | |
tree | 110022593c156d9e339e4e5fdb726e2e08049279 /src/native/common/Platforms.c | |
parent | 69b748925038b7d44fa6318536642b426e3d3e38 (diff) |
Add Clock, implementing proper monotonic and wallclock time using Instant (sec + nsec), currentTimeMillis() is also monotonic now, reused by Platform. Dropped Platform.currentTimeMicros()
Clock and its implementation was copied from jaulibs, a spin-off from Direct-BT.
The implementation uses `clock_gettime(CLOCK_MONOTONIC, &t)` and is considered safe and high-performant
as it avoids a kernel call via VDSO (GNU/Linux).
Diffstat (limited to 'src/native/common/Platforms.c')
-rw-r--r-- | src/native/common/Platforms.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/native/common/Platforms.c b/src/native/common/Platforms.c deleted file mode 100644 index f48d020..0000000 --- a/src/native/common/Platforms.c +++ /dev/null @@ -1,25 +0,0 @@ - -#include <jni.h> - -#include <assert.h> - -#include <gluegen_stdint.h> - -#include "com_jogamp_common_os_Platform.h" - -#include <sys/time.h> - -JNIEXPORT jlong JNICALL -Java_com_jogamp_common_os_Platform_currentTimeMillis(JNIEnv *env, jclass _unused) { - struct timeval tv; - gettimeofday(&tv,NULL); - return (int64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000; -} - -JNIEXPORT jlong JNICALL -Java_com_jogamp_common_os_Platform_currentTimeMicros(JNIEnv *env, jclass _unused) { - struct timeval tv; - gettimeofday(&tv,NULL); - return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; -} - |