X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Ftimestamp.h;h=6f08fc2e03fe641d993eabbedb684dee442212df;hp=9c82c23e2081dab9d8f3212bfd6c8e5ba1286a92;hb=14c65f15f708c27dc434db1f0d112fad2a0b007c;hpb=7c08b0b067f48e80226e6b5466fd95feb43139e6 diff --git a/src/timestamp.h b/src/timestamp.h index 9c82c23e..6f08fc2e 100644 --- a/src/timestamp.h +++ b/src/timestamp.h @@ -36,6 +36,13 @@ static inline u64 timeval_to_wim_timestamp(const struct timeval *tv) + (u64)tv->tv_usec * intervals_per_microsecond; } +static inline void wim_timestamp_to_timeval(u64 timestamp, struct timeval *tv) +{ + tv->tv_sec = (timestamp - intervals_1601_to_1970) / intervals_per_second; + tv->tv_usec = ((timestamp - intervals_1601_to_1970) / + intervals_per_microsecond) % 1000000; +} + static inline u64 timespec_to_wim_timestamp(const struct timespec *ts) { return intervals_1601_to_1970 @@ -43,6 +50,7 @@ static inline u64 timespec_to_wim_timestamp(const struct timespec *ts) + (u64)ts->tv_nsec / nanoseconds_per_interval; } + extern u64 get_wim_timestamp(); #endif