aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-25 13:47:53 +0200
committerDavid Robillard <d@drobilla.net>2019-07-25 14:16:24 +0200
commit2e3e935319ea740029bbb08d619331dddd72cf66 (patch)
tree3a05a9048867a493a5dd305a317ad3d287a4e010
parent9bc5853b7d951c879273cecbe2ef6e79fa2528fa (diff)
downloadpugl-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.
-rw-r--r--pugl/pugl_osx.m7
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