diff options
author | Ron Yorston <rmy@pobox.com> | 2021-08-09 08:59:43 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-08-09 08:59:43 +0100 |
commit | c50e9e73fa54237fb78167379ccb154dd4cd3cef (patch) | |
tree | 95ea6aad789463d0ddf8e64f89b4129d4caa334a | |
parent | 466cbfe6fd944a343caf29662f3b175a2ebdb7dc (diff) | |
download | busybox-w32-c50e9e73fa54237fb78167379ccb154dd4cd3cef.tar.gz busybox-w32-c50e9e73fa54237fb78167379ccb154dd4cd3cef.tar.bz2 busybox-w32-c50e9e73fa54237fb78167379ccb154dd4cd3cef.zip |
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.
-rw-r--r-- | win32/mingw.c | 10 |
1 files 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) | |||
308 | return winTime - 116444736000000000LL; | 308 | return winTime - 116444736000000000LL; |
309 | } | 309 | } |
310 | 310 | ||
311 | static inline time_t filetime_to_time_t(const FILETIME *ft) | ||
312 | { | ||
313 | return (time_t)(filetime_to_hnsec(ft) / 10000000); | ||
314 | } | ||
315 | |||
316 | static inline struct timespec filetime_to_timespec(const FILETIME *ft) | 311 | static inline struct timespec filetime_to_timespec(const FILETIME *ft) |
317 | { | 312 | { |
318 | struct timespec ts; | 313 | struct timespec ts; |
@@ -738,14 +733,15 @@ int mingw_fstat(int fd, struct mingw_stat *buf) | |||
738 | 733 | ||
739 | static inline void timeval_to_filetime(const struct timeval tv, FILETIME *ft) | 734 | static inline void timeval_to_filetime(const struct timeval tv, FILETIME *ft) |
740 | { | 735 | { |
741 | long long winTime = ((tv.tv_sec * 1000000LL) + tv.tv_usec) * 10LL + 116444736000000000LL; | 736 | long long winTime = tv.tv_sec * 10000000LL + tv.tv_usec * 10LL + |
737 | 116444736000000000LL; | ||
742 | ft->dwLowDateTime = winTime; | 738 | ft->dwLowDateTime = winTime; |
743 | ft->dwHighDateTime = winTime >> 32; | 739 | ft->dwHighDateTime = winTime >> 32; |
744 | } | 740 | } |
745 | 741 | ||
746 | static inline void timespec_to_filetime(const struct timespec tv, FILETIME *ft) | 742 | static inline void timespec_to_filetime(const struct timespec tv, FILETIME *ft) |
747 | { | 743 | { |
748 | long long winTime = (tv.tv_sec * 10000000LL) + tv.tv_nsec / 100LL + | 744 | long long winTime = tv.tv_sec * 10000000LL + tv.tv_nsec / 100LL + |
749 | 116444736000000000LL; | 745 | 116444736000000000LL; |
750 | ft->dwLowDateTime = winTime; | 746 | ft->dwLowDateTime = winTime; |
751 | ft->dwHighDateTime = winTime >> 32; | 747 | ft->dwHighDateTime = winTime >> 32; |