34#define NSTIME_INIT_ZERO {0, 0}
37#define NSTIME_INIT_UNSET {0, INT_MAX}
40#define NSTIME_INIT_SECS_NSECS(secs, nsecs) {secs, nsecs}
43#define NSTIME_INIT_SECS_USECS(secs, usecs) {secs, usecs*1000}
46#define NSTIME_INIT_SECS_MSECS(secs, msecs) {secs, msecs*1000000}
49#define NSTIME_INIT_SECS(secs) {secs, 0}
52#define NSTIME_INIT_MAX {sizeof(time_t) > sizeof(int) ? LONG_MAX : INT_MAX, INT_MAX}
72WS_DLL_PUBLIC
bool nstime_is_unset(
const nstime_t *nstime);
99#define nstime_add(sum, a) nstime_sum(sum, sum, a)
102#define nstime_subtract(sum, a) nstime_delta(sum, sum, a)
112WS_DLL_PUBLIC
unsigned nstime_hash(
const nstime_t *nstime);
150#define NSTIME_ISO8601_BUFSIZE sizeof("YYYY-MM-DDTHH:MM:SS.123456789Z")
152WS_DLL_PUBLIC
size_t nstime_to_iso8601(
char *buf,
size_t buf_size,
const nstime_t *nstime);
155#define NSTIME_UNIX_BUFSIZE (20+10+1)
157WS_DLL_PUBLIC
void nstime_to_unix(
char *buf,
size_t buf_size,
const nstime_t *nstime);
166 WS_TSPREC_100_MSEC = 1,
167 WS_TSPREC_10_MSEC = 2,
169 WS_TSPREC_100_USEC = 4,
170 WS_TSPREC_10_USEC = 5,
172 WS_TSPREC_100_NSEC = 7,
173 WS_TSPREC_10_NSEC = 8,
183#define WS_TSPREC_MAX 9
188#define NUM_WS_TSPREC_VALS (WS_TSPREC_MAX + 1)
199#define nstime_round(a, prec) nstime_rounded(a, a, prec)
WS_DLL_PUBLIC double nstime_to_msec(const nstime_t *nstime)
Definition nstime.c:193
WS_DLL_PUBLIC void nstime_sum(nstime_t *sum, const nstime_t *a, const nstime_t *b)
Definition nstime.c:123
WS_DLL_PUBLIC void nstime_set_unset(nstime_t *nstime)
Definition nstime.c:50
WS_DLL_PUBLIC void nstime_delta(nstime_t *delta, const nstime_t *b, const nstime_t *a)
Definition nstime.c:82
WS_DLL_PUBLIC void nstime_set_zero(nstime_t *nstime)
Definition nstime.c:28
WS_DLL_PUBLIC bool filetime_ns_to_nstime(nstime_t *nstime, uint64_t nsfiletime)
Definition nstime.c:300
iso8601_fmt_e
Definition nstime.h:134
@ ISO8601_DATETIME_AUTO
Definition nstime.h:137
@ ISO8601_DATETIME_BASIC
Definition nstime.h:136
WS_DLL_PUBLIC int nstime_cmp(const nstime_t *a, const nstime_t *b)
Definition nstime.c:144
WS_DLL_PUBLIC bool nstime_is_zero(const nstime_t *nstime)
Definition nstime.c:35
WS_DLL_PUBLIC bool filetime_to_nstime(nstime_t *nstime, uint64_t filetime)
Definition nstime.c:276
WS_DLL_PUBLIC void nstime_copy(nstime_t *a, const nstime_t *b)
Definition nstime.c:71
WS_DLL_PUBLIC void nstime_rounded(nstime_t *a, const nstime_t *b, ws_tsprec_e prec)
Definition nstime.c:208
WS_DLL_PUBLIC double nstime_to_sec(const nstime_t *nstime)
Definition nstime.c:203
WS_DLL_PUBLIC bool filetime_1sec_to_nstime(nstime_t *nstime, uint64_t filetime)
Definition nstime.c:321
WS_DLL_PUBLIC const char * iso8601_to_nstime(nstime_t *nstime, const char *ptr, iso8601_fmt_e format)
Definition nstime.c:360
WS_DLL_PUBLIC bool nstime_is_negative(const nstime_t *nstime)
Definition nstime.c:41
WS_DLL_PUBLIC const char * unix_epoch_to_nstime(nstime_t *nstime, const char *ptr)
Definition nstime.c:581