Converts a 64-bit file time (in form of a FILETIME structure) to system time format.
BOOL FileTimeToSystemTime( const FILETIME * lpFileTime, SYSTEMTIME * lpSystemTime )
nonzero for success, 0 for failure.
EX1
// The example displays system time of one file. int FileTimeToSystemTime_ex1() { string strFile = "c:\\myfile.txt"; ///Create new file HANDLE hFile; hFile = CreateFile( strFile, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { out_str("Could not Create file."); // process error return -1; } CloseHandle(hFile); WIN32_FILE_ATTRIBUTE_DATA fileInfo; // Get the attributes structure of the file if ( GetFileAttributesEx(strFile, 0, &fileInfo) ) { SYSTEMTIME stSystemTime; // Convert the last access time to SYSTEMTIME structure: if ( FileTimeToSystemTime(&fileInfo.ftLastAccessTime, &stSystemTime) ) { printf("Year = %d, Month = %d, Day = %d, Hour = %d, Minute = %d\n", stSystemTime.wYear, stSystemTime.wMonth, stSystemTime.wDay, stSystemTime.wHour, stSystemTime.wMinute); } } else out_str("Cannot get file attributes!"); return 1; }
origin.h