Change from HOUR to YEAR date format too early
|Reported by:||Bieringer Dominik||Owned by:|
|Component version:||Operating system type:|
|Operating system version:|
When requesting a directory listing from the FileZilla FTP Server, files that were modified very recently are listed with the HOUR and MINUTE fields; files that were modified long time ago are instead listed with the YEAR field.
Normally FTP servers change the format after about a year, which is - as far as I have understood - also the intended way the FileZilla FTP Server should work (see the comment in ticket #1317).
However, this is not the case, as the corresponding code does compare the difference between the current date and the file date wrongly; the related code in
256 pResult->len += sprintf(pResult->buffer + pResult->len, " %s %02d ", months[sFileTime.wMonth-1], sFileTime.wDay); 257 if (t1 > t2 || (t2-t1) > ((_int64)1000000*60*60*24*350)) 258 pResult->len += sprintf(pResult->buffer + pResult->len, " %d ", sFileTime.wYear); 259 else 260 pResult->len += sprintf(pResult->buffer + pResult->len, "%02d:%02d ", sFileTime.wHour, sFileTime.wMinute);
t2 and t1 are values of type FILETIME (see http://msdn.microsoft.com/en-us/library/ms724284(v=vs.85).aspx), which stores the time in 100-nanosecond intervals. As a nanosecond is 10-9s, which is 1 000 000 000, a value of 10 000 000 in a TIMESTAMP equals one second.
Therefore the comparison should read like
10 000 000*60*60*24*350 instead of
1 000 000*60*60*24*350.
With the current code, FileZilla changes the format of the listing after 35 days (because of the missing zero).