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