** 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). */
| 5671 | ** number of seconds since the Unix Epoch (1970-01-01 00:00:00 UTC). |
| 5672 | */ |
| 5673 | static sqlite3_uint64 fileTimeToUnixTime( |
| 5674 | LPFILETIME pFileTime |
| 5675 | ){ |
| 5676 | SYSTEMTIME epochSystemTime; |
| 5677 | ULARGE_INTEGER epochIntervals; |
| 5678 | FILETIME epochFileTime; |
| 5679 | ULARGE_INTEGER fileIntervals; |
| 5680 | |
| 5681 | memset(&epochSystemTime, 0, sizeof(SYSTEMTIME)); |
| 5682 | epochSystemTime.wYear = 1970; |
| 5683 | epochSystemTime.wMonth = 1; |
| 5684 | epochSystemTime.wDay = 1; |
| 5685 | SystemTimeToFileTime(&epochSystemTime, &epochFileTime); |
| 5686 | epochIntervals.LowPart = epochFileTime.dwLowDateTime; |
| 5687 | epochIntervals.HighPart = epochFileTime.dwHighDateTime; |
| 5688 | |
| 5689 | fileIntervals.LowPart = pFileTime->dwLowDateTime; |
| 5690 | fileIntervals.HighPart = pFileTime->dwHighDateTime; |
| 5691 | |
| 5692 | return (fileIntervals.QuadPart - epochIntervals.QuadPart) / 10000000; |
| 5693 | } |
| 5694 | |
| 5695 | |
| 5696 | #if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32)) |