Skip to content

Commit cc3c9e8

Browse files
kbleesdscho
authored andcommitted
Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <[email protected]>
1 parent bc18d18 commit cc3c9e8

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

compat/mingw.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,6 @@ int mingw_chmod(const char *filename, int mode)
493493
return _wchmod(wfilename, mode);
494494
}
495495

496-
/*
497-
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
498-
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
499-
*/
500-
static inline long long filetime_to_hnsec(const FILETIME *ft)
501-
{
502-
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
503-
/* Windows to Unix Epoch conversion */
504-
return winTime - 116444736000000000LL;
505-
}
506-
507-
static inline time_t filetime_to_time_t(const FILETIME *ft)
508-
{
509-
return (time_t)(filetime_to_hnsec(ft) / 10000000);
510-
}
511-
512496
/**
513497
* Verifies that safe_create_leading_directories() would succeed.
514498
*/

compat/mingw.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,22 @@ static inline int getrlimit(int resource, struct rlimit *rlp)
318318
return 0;
319319
}
320320

321+
/*
322+
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
323+
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
324+
*/
325+
static inline long long filetime_to_hnsec(const FILETIME *ft)
326+
{
327+
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
328+
/* Windows to Unix Epoch conversion */
329+
return winTime - 116444736000000000LL;
330+
}
331+
332+
static inline time_t filetime_to_time_t(const FILETIME *ft)
333+
{
334+
return (time_t)(filetime_to_hnsec(ft) / 10000000);
335+
}
336+
321337
/*
322338
* Use mingw specific stat()/lstat()/fstat() implementations on Windows.
323339
*/

0 commit comments

Comments
 (0)