@@ -40,10 +40,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
40
40
Serial.print (" DIR : " );
41
41
Serial.print (file.name ());
42
42
time_t t = file.getLastWrite ();
43
- struct tm *tmstruct = localtime (&t);
43
+ struct tm tmstruct;
44
+ localtime_r (&t, &tmstruct);
44
45
Serial.printf (
45
- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
46
- tmstruct-> tm_min , tmstruct-> tm_sec
46
+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
47
+ tmstruct. tm_min , tmstruct. tm_sec
47
48
);
48
49
if (levels) {
49
50
listDir (fs, file.path (), levels - 1 );
@@ -54,10 +55,11 @@ void listDir(fs::FS &fs, const char *dirname, uint8_t levels) {
54
55
Serial.print (" SIZE: " );
55
56
Serial.print (file.size ());
56
57
time_t t = file.getLastWrite ();
57
- struct tm *tmstruct = localtime (&t);
58
+ struct tm tmstruct;
59
+ localtime_r (&t, &tmstruct);
58
60
Serial.printf (
59
- " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct-> tm_year ) + 1900 , (tmstruct-> tm_mon ) + 1 , tmstruct-> tm_mday , tmstruct-> tm_hour ,
60
- tmstruct-> tm_min , tmstruct-> tm_sec
61
+ " LAST WRITE: %d-%02d-%02d %02d:%02d:%02d\n " , (tmstruct. tm_year ) + 1900 , (tmstruct. tm_mon ) + 1 , tmstruct. tm_mday , tmstruct. tm_hour ,
62
+ tmstruct. tm_min , tmstruct. tm_sec
61
63
);
62
64
}
63
65
file = root.openNextFile ();
0 commit comments