MCPcopy Create free account
hub / github.com/audacity/audacity / fileTimeToUnixTime

Function fileTimeToUnixTime

lib-src/sqlite/shell.c:2325–2345  ·  view source on GitHub ↗

** This function is designed to convert a Win32 FILETIME structure into the ** number of seconds since the Unix Epoch (1970-01-01 00:00:00 UTC). */

Source from the content-addressed store, hash-verified

2323** number of seconds since the Unix Epoch (1970-01-01 00:00:00 UTC).
2324*/
2325static sqlite3_uint64 fileTimeToUnixTime(
2326 LPFILETIME pFileTime
2327){
2328 SYSTEMTIME epochSystemTime;
2329 ULARGE_INTEGER epochIntervals;
2330 FILETIME epochFileTime;
2331 ULARGE_INTEGER fileIntervals;
2332
2333 memset(&epochSystemTime, 0, sizeof(SYSTEMTIME));
2334 epochSystemTime.wYear = 1970;
2335 epochSystemTime.wMonth = 1;
2336 epochSystemTime.wDay = 1;
2337 SystemTimeToFileTime(&epochSystemTime, &epochFileTime);
2338 epochIntervals.LowPart = epochFileTime.dwLowDateTime;
2339 epochIntervals.HighPart = epochFileTime.dwHighDateTime;
2340
2341 fileIntervals.LowPart = pFileTime->dwLowDateTime;
2342 fileIntervals.HighPart = pFileTime->dwHighDateTime;
2343
2344 return (fileIntervals.QuadPart - epochIntervals.QuadPart) / 10000000;
2345}
2346
2347/*
2348** This function attempts to normalize the time values found in the stat()

Callers 1

statTimesToUtcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected