blob: ca151f13b014e17c3621390321d054a705b4278a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#ifndef TIME_H_
#define TIME_H_
#include <time.h>
#define TIMESPEC_TO_DOUBLE(ts) ((double)(ts).tv_sec + ((double)(ts).tv_nsec / TIMESPEC_HZ))
enum { TIMESPEC_HZ = 1000000000 };
const struct timespec one_second = {1, 0}, zero_seconds = {0, 0};
struct timespec timespec_add(struct timespec a, struct timespec b);
struct timespec timespec_sub(struct timespec a, struct timespec b);
int timespec_cmp(struct timespec a, struct timespec b);
struct timespec timespec_min(struct timespec a, struct timespec b);
struct timespec timespec_max(struct timespec a, struct timespec b);
#endif /* TIME_H_ */
|