Changed the file date time adjustements

This commit is contained in:
anschrammh 2020-12-15 00:38:46 +01:00
parent 5611f59575
commit 3e193233b4

View File

@ -841,9 +841,10 @@ class FTPServer : public TCPServer<T>
if (!fileOrDir) //No more files in the directory
break;
//We try to retrieve the last modification date
const time_t fileModifDate = fileOrDir.getLastWrite();
//We try to retrieve the last modification date and we remove one day and one hour
const time_t fileModifDate = fileOrDir.getLastWrite() - 60*60;
struct tm *timeP = localtime(&fileModifDate);
//We get the month's three letter abbreviation
uint32_t monthAbbreviation = monthNumTo3LetterAbbreviation(timeP->tm_mon + 1); //+1 because in the tm struct, month goes from 0 to 11 ...
@ -858,7 +859,7 @@ class FTPServer : public TCPServer<T>
fileOrDir.isDirectory() ? 0 : fileOrDir.size(),
(char *)&monthAbbreviation,
dateTimeFormater(zero_prepended[0],timeP->tm_mday,'0'),
dateTimeFormater(zero_prepended[1],!timeP->tm_hour ? 23 : timeP->tm_hour-1 ,'0'),
dateTimeFormater(zero_prepended[1],timeP->tm_hour ,'0'),
dateTimeFormater(zero_prepended[2],timeP->tm_min,'0'),
fileOrDir.name());