diff options
Diffstat (limited to 'src/jogl/native/timespec.c')
-rw-r--r-- | src/jogl/native/timespec.c | 14 |
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; |