** 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. */
| 5714 | ** appears to return these values as local times. |
| 5715 | */ |
| 5716 | static void statTimesToUtc( |
| 5717 | const char *zPath, |
| 5718 | struct stat *pStatBuf |
| 5719 | ){ |
| 5720 | HANDLE hFindFile; |
| 5721 | WIN32_FIND_DATAW fd; |
| 5722 | LPWSTR zUnicodeName; |
| 5723 | extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*); |
| 5724 | zUnicodeName = sqlite3_win32_utf8_to_unicode(zPath); |
| 5725 | if( zUnicodeName ){ |
| 5726 | memset(&fd, 0, sizeof(WIN32_FIND_DATAW)); |
| 5727 | hFindFile = FindFirstFileW(zUnicodeName, &fd); |
| 5728 | if( hFindFile!=NULL ){ |
| 5729 | pStatBuf->st_ctime = (time_t)fileTimeToUnixTime(&fd.ftCreationTime); |
| 5730 | pStatBuf->st_atime = (time_t)fileTimeToUnixTime(&fd.ftLastAccessTime); |
| 5731 | pStatBuf->st_mtime = (time_t)fileTimeToUnixTime(&fd.ftLastWriteTime); |
| 5732 | FindClose(hFindFile); |
| 5733 | } |
| 5734 | sqlite3_free(zUnicodeName); |
| 5735 | } |
| 5736 | } |
| 5737 | #endif |
| 5738 | |
| 5739 | /* |
no test coverage detected