@@ -83,10 +83,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
8383 Serial.print (" DIR : " );
8484 Serial.print (file.name ());
8585 time_t t = file.getLastWrite ();
86- struct tm *tmstruct = localtime (&t);
86+ struct tm tmstruct;
87+ localtime_r (&t, &tmstruct);
8788 Serial.printf (
88- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
89- tmstruct-> tm_min , tmstruct-> tm_sec
89+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
90+ tmstruct. tm_min , tmstruct. tm_sec
9091 );
9192 if (levels) {
9293 listDir (fs, file.path (), levels - 1 );
@@ -97,10 +98,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
9798 Serial.print (" SIZE: " );
9899 Serial.print (file.size ());
99100 time_t t = file.getLastWrite ();
100- struct tm *tmstruct = localtime (&t);
101+ struct tm tmstruct;
102+ localtime_r (&t, &tmstruct);
101103 Serial.printf (
102- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
103- tmstruct-> tm_min , tmstruct-> tm_sec
104+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
105+ tmstruct. tm_min , tmstruct. tm_sec
104106 );
105107 }
106108 file = root.openNextFile ();
0 commit comments