]> wimlib.net Git - wimlib/blob - include/wimlib/timestamp.h
Improved year 2038 safety
[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 struct wimlib_timespec;
16
17 extern time_t
18 wim_timestamp_to_time_t(u64 timestamp);
19
20 extern void
21 wim_timestamp_to_wimlib_timespec(u64 timestamp, struct wimlib_timespec *wts,
22                                  s32 *high_part_ret);
23
24 extern struct timeval
25 wim_timestamp_to_timeval(u64 timestamp);
26
27 extern struct timespec
28 wim_timestamp_to_timespec(u64 timestamp);
29
30 extern u64
31 time_t_to_wim_timestamp(time_t t);
32
33 extern u64
34 timeval_to_wim_timestamp(const struct timeval *tv);
35
36 extern u64
37 timespec_to_wim_timestamp(const struct timespec *ts);
38
39 extern u64
40 now_as_wim_timestamp(void);
41
42 extern void
43 wim_timestamp_to_str(u64 timestamp, tchar *buf, size_t len);
44
45 #endif /* _WIMLIB_TIMESTAMP_H */