Commit dfedc61f authored by John van Groningen's avatar John van Groningen

fix daylight saving time bug in Directory for windows (don't use FileTimeToLocalFileTime)

parent e35a0484
......@@ -80,7 +80,7 @@ void getCommonFileInfoC(int also_get_file_name,
static int null=0;
FILETIME localFileTime;
SYSTEMTIME localSystemTime;
SYSTEMTIME systemTime,localSystemTime;
int i;
static CleanStringVariable(fileName,MAX_PATH);
static size_t nix = 0;
......@@ -95,15 +95,27 @@ void getCommonFileInfoC(int also_get_file_name,
*pFileName = (CleanString) &nix;
*pFileSizeLow = gWFD.nFileSizeLow;
*pFileSizeHigh = gWFD.nFileSizeHigh;
FileTimeToLocalFileTime(&gWFD.ftLastWriteTime,&localFileTime);
FileTimeToSystemTime(&localFileTime,&localSystemTime);
*pYear = localSystemTime.wYear;
*pMonth = localSystemTime.wMonth;
*pDay = localSystemTime.wDay;
*pDayNr = localSystemTime.wDayOfWeek+1;
*pHours = localSystemTime.wHour;
*pMinutes = localSystemTime.wMinute;
*pSeconds = localSystemTime.wSecond;
if (FileTimeToSystemTime (&gWFD.ftLastWriteTime,&systemTime)
&& SystemTimeToTzSpecificLocalTime (NULL,&systemTime,&localSystemTime))
{
*pYear = localSystemTime.wYear;
*pMonth = localSystemTime.wMonth;
*pDay = localSystemTime.wDay;
*pDayNr = localSystemTime.wDayOfWeek+1;
*pHours = localSystemTime.wHour;
*pMinutes = localSystemTime.wMinute;
*pSeconds = localSystemTime.wSecond;
} else {
*pYear = 0;
*pMonth = 0;
*pDay = 0;
*pDayNr = 1;
*pHours = 0;
*pMinutes = 0;
*pSeconds = 0;
}
*pIsDirectory = (gWFD.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
*pIsReadOnly = (gWFD.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0;
}
......@@ -118,29 +130,52 @@ void getWindowsFileInfoC(int *pFileAttributes,
CleanString *pDOSName, int *pIsHidden)
{
FILETIME localFileTime;
SYSTEMTIME localSystemTime;
SYSTEMTIME systemTime,localSystemTime;
int i;
static CleanStringVariable(fileName,ALT_LENGTH);
*pFileAttributes = gWFD.dwFileAttributes;
FileTimeToLocalFileTime(&gWFD.ftCreationTime,&localFileTime);
FileTimeToSystemTime(&localFileTime,&localSystemTime);
*pCYear = localSystemTime.wYear;
*pCMonth = localSystemTime.wMonth;
*pCDay = localSystemTime.wDay;
*pCDayNr = localSystemTime.wDayOfWeek+1;
*pCHours = localSystemTime.wHour;
*pCMinutes = localSystemTime.wMinute;
*pCSeconds = localSystemTime.wSecond;
FileTimeToLocalFileTime(&gWFD.ftLastAccessTime,&localFileTime);
FileTimeToSystemTime(&localFileTime,&localSystemTime);
*pLAYear = localSystemTime.wYear;
*pLAMonth = localSystemTime.wMonth;
*pLADay = localSystemTime.wDay;
*pLADayNr = localSystemTime.wDayOfWeek+1;
*pLAHours = localSystemTime.wHour;
*pLAMinutes = localSystemTime.wMinute;
*pLASeconds = localSystemTime.wSecond;
if (FileTimeToSystemTime (&gWFD.ftCreationTime,&systemTime)
&& SystemTimeToTzSpecificLocalTime (NULL,&systemTime,&localSystemTime))
{
*pCYear = localSystemTime.wYear;
*pCMonth = localSystemTime.wMonth;
*pCDay = localSystemTime.wDay;
*pCDayNr = localSystemTime.wDayOfWeek+1;
*pCHours = localSystemTime.wHour;
*pCMinutes = localSystemTime.wMinute;
*pCSeconds = localSystemTime.wSecond;
} else {
*pCYear = 0;
*pCMonth = 0;
*pCDay = 0;
*pCDayNr = 1;
*pCHours = 0;
*pCMinutes = 0;
*pCSeconds = 0;
}
if (FileTimeToSystemTime (&gWFD.ftLastAccessTime,&systemTime)
&& SystemTimeToTzSpecificLocalTime (NULL,&systemTime,&localSystemTime))
{
*pLAYear = localSystemTime.wYear;
*pLAMonth = localSystemTime.wMonth;
*pLADay = localSystemTime.wDay;
*pLADayNr = localSystemTime.wDayOfWeek+1;
*pLAHours = localSystemTime.wHour;
*pLAMinutes = localSystemTime.wMinute;
*pLASeconds = localSystemTime.wSecond;
} else {
*pLAYear = 0;
*pLAMonth = 0;
*pLADay = 0;
*pLADayNr = 1;
*pLAHours = 0;
*pLAMinutes = 0;
*pLASeconds = 0;
}
for(i=0; gWFD.cAlternateFileName[i]!='\0' && i<ALT_LENGTH; i++)
CleanStringCharacters(fileName)[i] = gWFD.cAlternateFileName[i];
CleanStringLength(fileName) = i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment