summaryrefslogtreecommitdiffstats
path: root/src/jogl/native/timespec.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-22 05:12:16 +0200
committerSven Gothel <[email protected]>2012-04-22 05:12:16 +0200
commit9d522e77a9ac1f85c57236f00d5432e671f9169c (patch)
tree79c86efc114560393c6e870f55365c2726307130 /src/jogl/native/timespec.c
parent218d67fc0222d7709b21c45792d44501351939c4 (diff)
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.
Diffstat (limited to 'src/jogl/native/timespec.c')
-rw-r--r--src/jogl/native/timespec.c14
1 files changed, 14 insertions, 0 deletions
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;