diff options
author | David Robillard <d@drobilla.net> | 2019-07-25 13:47:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-07-25 14:16:24 +0200 |
commit | 2e3e935319ea740029bbb08d619331dddd72cf66 (patch) | |
tree | 3a05a9048867a493a5dd305a317ad3d287a4e010 /pugl | |
parent | 9bc5853b7d951c879273cecbe2ef6e79fa2528fa (diff) | |
download | pugl-2e3e935319ea740029bbb08d619331dddd72cf66.tar.gz pugl-2e3e935319ea740029bbb08d619331dddd72cf66.tar.bz2 pugl-2e3e935319ea740029bbb08d619331dddd72cf66.zip |
Mac: Use mach_absolute_time()
This fixes the build for older versions of MacOS, since clock_gettime() was
only added in 10.12.
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/pugl_osx.m | 7 |
1 files changed, 3 insertions, 4 deletions
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 <Cocoa/Cocoa.h> +#include <mach/mach_time.h> + #include <stdlib.h> -#include <time.h> @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 |