Skip to content

Commit 442ccdc

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

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
@@ -541,22 +541,6 @@ int mingw_chmod(const char *filename, int mode)
541541
return _wchmod(wfilename, mode);
542542
}
543543

544-
/*
545-
* The unit of FILETIME is 100-nanoseconds since January 1, 1601, UTC.
546-
* Returns the 100-nanoseconds ("hekto nanoseconds") since the epoch.
547-
*/
548-
static inline long long filetime_to_hnsec(const FILETIME *ft)
549-
{
550-
long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime;
551-
/* Windows to Unix Epoch conversion */
552-
return winTime - 116444736000000000LL;
553-
}
554-
555-
static inline time_t filetime_to_time_t(const FILETIME *ft)
556-
{
557-
return (time_t)(filetime_to_hnsec(ft) / 10000000);
558-
}
559-
560544
/**
561545
* Verifies that safe_create_leading_directories() would succeed.
562546
*/

compat/mingw.h

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

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

0 commit comments

Comments
 (0)