@@ -83,10 +83,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
83
83
Serial.print (" DIR : " );
84
84
Serial.print (file.name ());
85
85
time_t t = file.getLastWrite ();
86
- struct tm *tmstruct = localtime (&t);
86
+ struct tm tmstruct;
87
+ localtime_r (&t, &tmstruct);
87
88
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
90
91
);
91
92
if (levels) {
92
93
listDir (fs, file.path (), levels - 1 );
@@ -97,10 +98,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
97
98
Serial.print (" SIZE: " );
98
99
Serial.print (file.size ());
99
100
time_t t = file.getLastWrite ();
100
- struct tm *tmstruct = localtime (&t);
101
+ struct tm tmstruct;
102
+ localtime_r (&t, &tmstruct);
101
103
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
104
106
);
105
107
}
106
108
file = root.openNextFile ();
0 commit comments