Skip to content

Commit 2a23b94

Browse files
kbleesGit for Windows Build Agent
authored andcommitted
Win32: make FILETIME conversion functions public
Signed-off-by: Karsten Blees <[email protected]>
1 parent 536dc17 commit 2a23b94

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
@@ -512,22 +512,6 @@ int mingw_chmod(const char *filename, int mode)
512512
return _wchmod(wfilename, mode);
513513
}
514514

515-
/*
516-
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
517-
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
518-
*/
519-
static inline long long filetime_to_hnsec(const FILETIME *ft)
520-
{
521-
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
522-
/* Windows to Unix Epoch conversion */
523-
return winTime - 116444736000000000LL;
524-
}
525-
526-
static inline time_t filetime_to_time_t(const FILETIME *ft)
527-
{
528-
return (time_t)(filetime_to_hnsec(ft) / 10000000);
529-
}
530-
531515
/**
532516
* Verifies that safe_create_leading_directories() would succeed.
533517
*/

compat/mingw.h

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

329+
/*
330+
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
331+
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
332+
*/
333+
static inline long long filetime_to_hnsec(const FILETIME *ft)
334+
{
335+
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
336+
/* Windows to Unix Epoch conversion */
337+
return winTime - 116444736000000000LL;
338+
}
339+
340+
static inline time_t filetime_to_time_t(const FILETIME *ft)
341+
{
342+
return (time_t)(filetime_to_hnsec(ft) / 10000000);
343+
}
344+
329345
/*
330346
* Use mingw specific stat()/lstat()/fstat() implementations on Windows.
331347
*/

0 commit comments

Comments
 (0)