summaryrefslogtreecommitdiff
path: root/src/timespec.h
blob: 2bf11829141cee423c0ec8b2b68d70b0121d8b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * \file timespec.h
 * Declares timespec struct if platform is missing it
 */

#ifndef TIMESPEC_H
#define TIMESPEC_H

#include <time.h>
#if !HAVE_STRUCT_TIMESPEC
struct timespec
{
    time_t tv_sec;
    long tv_nsec;
};
#endif

NONULL void timespec_now(struct timespec *ts);

NONULL void timespec_addms(struct timespec *ts, unsigned long ms);
NONULL void timespec_add(struct timespec *ts, const struct timespec *add);

NONULL int timespec_sub(struct timespec *ts, const struct timespec *sub);
NONULL int timespec_cmp(const struct timespec *x, const struct timespec *y);

#endif /* TIMESPEC_H */