summaryrefslogtreecommitdiffstats
path: root/src/native/common/Platforms.c
blob: f48d020b75aa075a91a2daef0e9a064b92af8069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#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;
}