From c50e9e73fa54237fb78167379ccb154dd4cd3cef Mon Sep 17 00:00:00 2001 From: Ron Yorston <rmy@pobox.com> Date: Mon, 9 Aug 2021 08:59:43 +0100 Subject: win32: tidy up time conversions Remove filetime_to_time_t(): it's no longer used. Align style of time{spec,val}_to_filetime() to make it easier to compare what they do. --- win32/mingw.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/win32/mingw.c b/win32/mingw.c index 943202f41..49dcd89d8 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -308,11 +308,6 @@ static inline long long filetime_to_hnsec(const FILETIME *ft) return winTime - 116444736000000000LL; } -static inline time_t filetime_to_time_t(const FILETIME *ft) -{ - return (time_t)(filetime_to_hnsec(ft) / 10000000); -} - static inline struct timespec filetime_to_timespec(const FILETIME *ft) { struct timespec ts; @@ -738,14 +733,15 @@ int mingw_fstat(int fd, struct mingw_stat *buf) static inline void timeval_to_filetime(const struct timeval tv, FILETIME *ft) { - long long winTime = ((tv.tv_sec * 1000000LL) + tv.tv_usec) * 10LL + 116444736000000000LL; + long long winTime = tv.tv_sec * 10000000LL + tv.tv_usec * 10LL + + 116444736000000000LL; ft->dwLowDateTime = winTime; ft->dwHighDateTime = winTime >> 32; } static inline void timespec_to_filetime(const struct timespec tv, FILETIME *ft) { - long long winTime = (tv.tv_sec * 10000000LL) + tv.tv_nsec / 100LL + + long long winTime = tv.tv_sec * 10000000LL + tv.tv_nsec / 100LL + 116444736000000000LL; ft->dwLowDateTime = winTime; ft->dwHighDateTime = winTime >> 32; -- cgit v1.2.3-55-g6feb