aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/native/timespec.h
blob: a621562b96097dd9fa44d7d9f4dc6bb661f1d8a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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_addmicros(struct timespec *ts, long micro);
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);

/** convert the timespec into microseconds (may overflow) */
long timespec_microseconds(struct timespec *a);

#endif /* _timespec_h */