@@ -78,10 +78,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
7878 Serial.print (" DIR : " );
7979 Serial.print (file.name ());
8080 time_t t = file.getLastWrite ();
81- struct tm *tmstruct = localtime (&t);
81+ struct tm tmstruct;
82+ localtime_r (&t, &tmstruct);
8283 Serial.printf (
83- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
84- tmstruct-> tm_min , tmstruct-> tm_sec
84+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
85+ tmstruct. tm_min , tmstruct. tm_sec
8586 );
8687 if (levels) {
8788 listDir (fs, file.path (), levels - 1 );
@@ -92,10 +93,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
9293 Serial.print (" SIZE: " );
9394 Serial.print (file.size ());
9495 time_t t = file.getLastWrite ();
95- struct tm *tmstruct = localtime (&t);
96+ struct tm tmstruct;
97+ localtime_r (&t, &tmstruct);
9698 Serial.printf (
97- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
98- tmstruct-> tm_min , tmstruct-> tm_sec
99+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
100+ tmstruct. tm_min , tmstruct. tm_sec
99101 );
100102 }
101103 file = root.openNextFile ();
0 commit comments