From 2e3e935319ea740029bbb08d619331dddd72cf66 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 25 Jul 2019 13:47:53 +0200 Subject: Mac: Use mach_absolute_time() This fixes the build for older versions of MacOS, since clock_gettime() was only added in 10.12. --- pugl/pugl_osx.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pugl') diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 7a171f8..af470cb 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -30,8 +30,9 @@ #import +#include + #include -#include @class PuglOpenGLView; @@ -928,9 +929,7 @@ puglGetProcAddress(const char *name) double puglGetTime(PuglView* view) { - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return ((double)ts.tv_sec + ts.tv_nsec / 1000000000.0) - view->start_time; + return (mach_absolute_time() / 1e9) - view->start_time; } void -- cgit v1.2.1