Compare commits
No commits in common. "5611f59575ec3955a270910211438ce12e23d1dd" and "1b15bd4c9bd3cc71a9619a81abf3050436063c26" have entirely different histories.
5611f59575
...
1b15bd4c9b
@ -844,11 +844,11 @@ class FTPServer : public TCPServer<T>
|
|||||||
//We try to retrieve the last modification date
|
//We try to retrieve the last modification date
|
||||||
const time_t fileModifDate = fileOrDir.getLastWrite();
|
const time_t fileModifDate = fileOrDir.getLastWrite();
|
||||||
struct tm *timeP = localtime(&fileModifDate);
|
struct tm *timeP = localtime(&fileModifDate);
|
||||||
//We get the month's three letter abbreviation
|
//Buffer necessary to store 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 ...
|
char month[4] = "";
|
||||||
|
|
||||||
#ifdef DEBUG_FTPS
|
#ifdef DEBUG_FTPS
|
||||||
Serial.printf("Filename : %s, %s %d %d %d:%d\n", fileOrDir.name(), (char *)&monthAbbreviation, timeP->tm_mon, timeP->tm_mday, timeP->tm_hour, timeP->tm_min);
|
Serial.printf("Filename : %s, %s %d %d %d:%d\n", fileOrDir.name(), monthNumTo3LetterAbbreviation(month, timeP->tm_mon), timeP->tm_mon, timeP->tm_mday, timeP->tm_hour, timeP->tm_min);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char zero_prepended[3][3] = {"","",""};
|
char zero_prepended[3][3] = {"","",""};
|
||||||
@ -856,7 +856,7 @@ class FTPServer : public TCPServer<T>
|
|||||||
client->_dataClient.printf("%crwxrwxrwx 1 owner esp8266 %d %s %s %s:%s %s\r\n",
|
client->_dataClient.printf("%crwxrwxrwx 1 owner esp8266 %d %s %s %s:%s %s\r\n",
|
||||||
fileOrDir.isDirectory() ? 'd' : '-',
|
fileOrDir.isDirectory() ? 'd' : '-',
|
||||||
fileOrDir.isDirectory() ? 0 : fileOrDir.size(),
|
fileOrDir.isDirectory() ? 0 : fileOrDir.size(),
|
||||||
(char *)&monthAbbreviation,
|
monthNumTo3LetterAbbreviation(month, timeP->tm_mon + 1), //+1 because in the tm struct, month goes from 0 to 11 ...
|
||||||
dateTimeFormater(zero_prepended[0],timeP->tm_mday,'0'),
|
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 ? 23 : timeP->tm_hour-1 ,'0'),
|
||||||
dateTimeFormater(zero_prepended[2],timeP->tm_min,'0'),
|
dateTimeFormater(zero_prepended[2],timeP->tm_min,'0'),
|
||||||
|
@ -72,17 +72,16 @@ char *lastIndexOf(char *str, const char character)
|
|||||||
* The monthNumTo3LetterAbbreviation function takes the month number from 1 to 12 and returns the abbreviation in a 3 letter
|
* The monthNumTo3LetterAbbreviation function takes the month number from 1 to 12 and returns the abbreviation in a 3 letter
|
||||||
* format.
|
* format.
|
||||||
*/
|
*/
|
||||||
uint32_t monthNumTo3LetterAbbreviation(const uint8_t monthNumber)
|
char *monthNumTo3LetterAbbreviation(char *buffer, const uint8_t monthNumber)
|
||||||
{
|
{
|
||||||
/**
|
static const char monthArray[][4] = {{"Jan"},{"Feb"},{"Mar"},{"Apr"},{"May"},{"Jun"},{"Jul"},{"Aug"},{"Sep"},{"Oct"},{"Nov"},{"Dec"}};
|
||||||
* This array contains months as 3 letter abbreviations
|
|
||||||
* Jan is written \0naJ and in hex : 0x006E614A an so on. They are thus 4Bytes aligned and easy to put and read back from prog mem :)
|
if(buffer == NULL) return NULL;
|
||||||
*/
|
|
||||||
static const uint32_t PROGMEM monthArray[] = {0x6E614A, 0x626546, 0x72614D, 0x727041, 0x79614D, 0x6E754A, 0x6C754A, 0x677541, 0x706553, 0x74634F, 0x766f4E, 0x636544};
|
|
||||||
uint32_t toReturn(0x6E614A); //Default to Jan.
|
|
||||||
|
|
||||||
if(monthNumber >= 1 && monthNumber <= 12)
|
if(monthNumber >= 1 && monthNumber <= 12)
|
||||||
toReturn = monthArray[monthNumber - 1];
|
strcpy_P(buffer, monthArray[monthNumber-1]);
|
||||||
|
else //If the month number is garbage, we return the first month of the year
|
||||||
|
strcpy_P(buffer, monthArray[0]);
|
||||||
|
|
||||||
return toReturn;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,6 @@ char *lastIndexOf(char *str, const char character);
|
|||||||
|
|
||||||
char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
|
char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
|
||||||
|
|
||||||
uint32_t monthNumTo3LetterAbbreviation(const uint8_t monthNumber);
|
char *monthNumTo3LetterAbbreviation(char *month, const uint8_t monthNumber);
|
||||||
|
|
||||||
#endif //DEFINITION_H
|
#endif //DEFINITION_H
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#define SOFT_VERSION "1.6.4" //Added the forceRefresh() method to the ScreenManager Object
|
#define SOFT_VERSION "1.6.4" //Added the forceRefresh() method to the ScreenManager Object
|
||||||
#define SOFT_VERSION "1.6.5" //Removed the sd card mount and unmount api calls, replaced with the sdCardAction api call which takes a parameter (does the same thing)
|
#define SOFT_VERSION "1.6.5" //Removed the sd card mount and unmount api calls, replaced with the sdCardAction api call which takes a parameter (does the same thing)
|
||||||
#define SOFT_VERSION "1.6.6" //Removed useless INIT state that was like the LINE_BREAK state and added '-' as an allowed PARAM and VALUE character
|
#define SOFT_VERSION "1.6.6" //Removed useless INIT state that was like the LINE_BREAK state and added '-' as an allowed PARAM and VALUE character
|
||||||
#define SOFT_VERSION "1.6.7" //Changed the way we store and return the 3 letter month abbreviation
|
|
||||||
|
|
||||||
|
|
||||||
#endif //VERSIONS_H
|
#endif //VERSIONS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user