From af6f13c7faecfa96aed8764e39547f8bb1013af8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 10 Jun 2017 12:07:25 -0700 Subject: [PATCH] Use clock_gettime() for better timestamps on platforms that support it --- src/Platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Platform.c b/src/Platform.c index d92cba0..980751f 100755 --- a/src/Platform.c +++ b/src/Platform.c @@ -292,6 +292,12 @@ int PltWaitForEvent(PLT_EVENT* event) { uint64_t PltGetMillis(void) { #if defined(LC_WINDOWS) return GetTickCount64(); +#elif HAVE_CLOCK_GETTIME + struct timespec tv; + + clock_gettime(CLOCK_MONOTONIC, &tv); + + return (tv.tv_sec * 1000) + (tv.tv_nsec / 1000000); #else struct timeval tv;