File tree Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,17 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
343343 return 0 ;
344344}
345345
346+ /*
347+ * The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
348+ * Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
349+ */
350+ static inline long long filetime_to_hnsec (const FILETIME * ft )
351+ {
352+ long long winTime = ((long long )ft -> dwHighDateTime << 32 ) + ft -> dwLowDateTime ;
353+ /* Windows to Unix Epoch conversion */
354+ return winTime - 116444736000000000LL ;
355+ }
356+
346357/*
347358 * Use mingw specific stat()/lstat()/fstat() implementations on Windows,
348359 * including our own struct stat with 64 bit st_size and nanosecond-precision
@@ -359,6 +370,13 @@ struct timespec {
359370#endif
360371#endif
361372
373+ static inline void filetime_to_timespec (const FILETIME * ft , struct timespec * ts )
374+ {
375+ long long hnsec = filetime_to_hnsec (ft );
376+ ts -> tv_sec = (time_t )(hnsec / 10000000 );
377+ ts -> tv_nsec = (hnsec % 10000000 ) * 100 ;
378+ }
379+
362380struct mingw_stat {
363381 _dev_t st_dev ;
364382 _ino_t st_ino ;
Original file line number Diff line number Diff line change @@ -883,24 +883,6 @@ int mingw_chmod(const char *filename, int mode)
883883 return _wchmod (wfilename , mode );
884884}
885885
886- /*
887- * The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
888- * Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
889- */
890- static inline long long filetime_to_hnsec (const FILETIME * ft )
891- {
892- long long winTime = ((long long )ft -> dwHighDateTime << 32 ) + ft -> dwLowDateTime ;
893- /* Windows to Unix Epoch conversion */
894- return winTime - 116444736000000000LL ;
895- }
896-
897- static inline void filetime_to_timespec (const FILETIME * ft , struct timespec * ts )
898- {
899- long long hnsec = filetime_to_hnsec (ft );
900- ts -> tv_sec = (time_t )(hnsec / 10000000 );
901- ts -> tv_nsec = (hnsec % 10000000 ) * 100 ;
902- }
903-
904886/**
905887 * Verifies that safe_create_leading_directories() would succeed.
906888 */
You can’t perform that action at this time.
0 commit comments