18 #ifndef _BOILERPLATE_TIME_H 19 #define _BOILERPLATE_TIME_H 23 typedef unsigned long long ticks_t;
25 typedef long long sticks_t;
31 void timespec_sub(
struct timespec *__restrict r,
32 const struct timespec *__restrict t1,
33 const struct timespec *__restrict t2);
35 void timespec_subs(
struct timespec *__restrict r,
36 const struct timespec *__restrict t1,
39 void timespec_add(
struct timespec *__restrict r,
40 const struct timespec *__restrict t1,
41 const struct timespec *__restrict t2);
43 void timespec_adds(
struct timespec *__restrict r,
44 const struct timespec *__restrict t1,
47 void timespec_sets(
struct timespec *__restrict r,
54 static inline sticks_t timespec_scalar(
const struct timespec *__restrict t)
56 return t->tv_sec * 1000000000LL + t->tv_nsec;
60 timespec_before(
const struct timespec *__restrict t1,
61 const struct timespec *__restrict t2)
63 if (t1->tv_sec < t2->tv_sec)
66 if (t1->tv_sec == t2->tv_sec &&
67 t1->tv_nsec < t2->tv_nsec)
74 timespec_before_or_same(
const struct timespec *__restrict t1,
75 const struct timespec *__restrict t2)
77 if (t1->tv_sec < t2->tv_sec)
80 if (t1->tv_sec == t2->tv_sec &&
81 t1->tv_nsec <= t2->tv_nsec)
88 timespec_after(
const struct timespec *__restrict t1,
89 const struct timespec *__restrict t2)
91 return !timespec_before_or_same(t1, t2);
95 timespec_after_or_same(
const struct timespec *__restrict t1,
96 const struct timespec *__restrict t2)
98 return !timespec_before(t1, t2);
static int __attribute__((cold))
Test if a mutex structure contains a valid autoinitializer.
Definition: mutex.c:177