Cleanup timestamp conversion code
[wimlib] / include / wimlib / timestamp.h
1 /*
2  * timestamp.h
3  *
4  * Conversion between Windows NT timestamps and UNIX timestamps.
5  */
6
7 #ifndef _WIMLIB_TIMESTAMP_H
8 #define _WIMLIB_TIMESTAMP_H
9
10 #include <sys/time.h>
11 #include <time.h>
12
13 #include "wimlib/types.h"
14
15 extern time_t
16 wim_timestamp_to_time_t(u64 timestamp);
17
18 extern struct timeval
19 wim_timestamp_to_timeval(u64 timestamp);
20
21 extern struct timespec
22 wim_timestamp_to_timespec(u64 timestamp);
23
24 extern u64
25 time_t_to_wim_timestamp(time_t t);
26
27 extern u64
28 timeval_to_wim_timestamp(const struct timeval *tv);
29
30 extern u64
31 timespec_to_wim_timestamp(const struct timespec *ts);
32
33 extern u64
34 now_as_wim_timestamp(void);
35
36 extern void
37 wim_timestamp_to_str(u64 timestamp, tchar *buf, size_t len);
38
39 #endif /* _WIMLIB_TIMESTAMP_H */