diff options
author | Sven Gothel <[email protected]> | 2011-11-08 23:42:26 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-08 23:42:26 +0100 |
commit | 48c2ba5ee339487ef56ba58d861cb923e3d0c432 (patch) | |
tree | 5559b3a37c43fcdc80d3ef3f756aceec7ac91336 /src/jogl/native/timespec.h | |
parent | 368cbf4462d7f3635c1ef4497424c360b5ccc203 (diff) |
JOGL: Add 'struct timespec' (POSIX) utils for native time handling
Diffstat (limited to 'src/jogl/native/timespec.h')
-rw-r--r-- | src/jogl/native/timespec.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/jogl/native/timespec.h b/src/jogl/native/timespec.h new file mode 100644 index 000000000..671eb4716 --- /dev/null +++ b/src/jogl/native/timespec.h @@ -0,0 +1,19 @@ +#ifndef _timespec_h +#define _timespec_h + +#include <time.h> + +void timespec_now(struct timespec *ts); +void timespec_addms(struct timespec *ts, long ms); +void timespec_addns(struct timespec *ts, long ns); + +/** returns 0: a==b, >0: a>b, <0: a<b */ +int timespec_compare(struct timespec *a, struct timespec *b); + +/** computes r = a - b */ +void timespec_subtract(struct timespec *r, struct timespec *a, struct timespec *b); + +/** convert the timespec into milliseconds (may overflow) */ +long timespec_milliseconds(struct timespec *a); + +#endif /* _timespec_h */ |