From 9d522e77a9ac1f85c57236f00d5432e671f9169c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 22 Apr 2012 05:12:16 +0200 Subject: Completing swap-interval implementation for OSX's CALayer usage. Closing Bug 555 - Based on Andres Colubri's initiative and commit 218d67fc0222d7709b21c45792d44501351939c4. - Reading real screen refresh rate ('stolen' from NEWT) - Properly handling swap-interval and vsync-to in native code - Increasing accuracy vsync-to to microseconds Tested manually w/ TestGearsES2AWT. --- src/jogl/native/timespec.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/jogl/native/timespec.c') diff --git a/src/jogl/native/timespec.c b/src/jogl/native/timespec.c index 74c1a6901..50f0ca8c5 100644 --- a/src/jogl/native/timespec.c +++ b/src/jogl/native/timespec.c @@ -24,6 +24,20 @@ void timespec_addms(struct timespec *ts, long ms) ts->tv_nsec=ts->tv_nsec%1000000000; } +void timespec_addmicros(struct timespec *ts, long micro) +{ + int sec=micro/1000000; + micro=micro - sec*1000000; + + // perform the addition + ts->tv_nsec+=micro*1000; + + // adjust the time + ts->tv_sec+=ts->tv_nsec/1000000000 + sec; + ts->tv_nsec=ts->tv_nsec%1000000000; + +} + void timespec_addns(struct timespec *ts, long ns) { int sec=ns/1000000000; -- cgit v1.2.3