** This function attempts to normalize the time values found in the stat() ** buffer to UTC. This is necessary on Win32, where the runtime library ** appears to return these values as local times. */
| 2350 | ** appears to return these values as local times. |
| 2351 | */ |
| 2352 | static void statTimesToUtc( |
| 2353 | const char *zPath, |
| 2354 | struct stat *pStatBuf |
| 2355 | ){ |
| 2356 | HANDLE hFindFile; |
| 2357 | WIN32_FIND_DATAW fd; |
| 2358 | LPWSTR zUnicodeName; |
| 2359 | extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*); |
| 2360 | zUnicodeName = sqlite3_win32_utf8_to_unicode(zPath); |
| 2361 | if( zUnicodeName ){ |
| 2362 | memset(&fd, 0, sizeof(WIN32_FIND_DATAW)); |
| 2363 | hFindFile = FindFirstFileW(zUnicodeName, &fd); |
| 2364 | if( hFindFile!=NULL ){ |
| 2365 | pStatBuf->st_ctime = (time_t)fileTimeToUnixTime(&fd.ftCreationTime); |
| 2366 | pStatBuf->st_atime = (time_t)fileTimeToUnixTime(&fd.ftLastAccessTime); |
| 2367 | pStatBuf->st_mtime = (time_t)fileTimeToUnixTime(&fd.ftLastWriteTime); |
| 2368 | FindClose(hFindFile); |
| 2369 | } |
| 2370 | sqlite3_free(zUnicodeName); |
| 2371 | } |
| 2372 | } |
| 2373 | #endif |
| 2374 | |
| 2375 | /* |
no test coverage detected