@@ -28,10 +28,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
28
28
Serial.print (" DIR : " );
29
29
Serial.print (file.name ());
30
30
time_t t = file.getLastWrite ();
31
- struct tm *tmstruct = localtime (&t);
31
+ struct tm tmstruct;
32
+ localtime_r (&t, &tmstruct);
32
33
Serial.printf (
33
- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
34
- tmstruct-> tm_min , tmstruct-> tm_sec
34
+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
35
+ tmstruct. tm_min , tmstruct. tm_sec
35
36
);
36
37
if (levels) {
37
38
listDir (fs, file.path (), levels - 1 );
@@ -42,10 +43,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
42
43
Serial.print (" SIZE: " );
43
44
Serial.print (file.size ());
44
45
time_t t = file.getLastWrite ();
45
- struct tm *tmstruct = localtime (&t);
46
+ struct tm tmstruct;
47
+ localtime_r (&t, &tmstruct);
46
48
Serial.printf (
47
- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
48
- tmstruct-> tm_min , tmstruct-> tm_sec
49
+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
50
+ tmstruct. tm_min , tmstruct. tm_sec
49
51
);
50
52
}
51
53
file = root.openNextFile ();
0 commit comments