Open mikrocoder opened 2 months ago
I believe this is also a problem with the Espressif ESP32 SD library. The data structures for the file FAT entry are not in the .h files , e.g. FAT_TIME, FAT_DATE.
Typically you'd write a simple dateTimeCallback function that would include the current time & date information when ever a directory or file is created. That's not an option in the Espressif versions - the structure definition's are missing in the .h
See: https://forum.arduino.cc/t/add-date-and-time-to-your-sd-card-files/318901
Typically you'd write a simple dateTimeCallback function that would include the current time & date information when ever a directory or file is created.
littlefs and fatfs ports for ESP32 use standard C library or POSIX functions such as time
and gettimeofday
to obtain current time. So if you set the current time using settimeofday
, then these filesystems will use correct time.
Thanks.
Thanks goes to Igrr, he pointed that out. I'd missed it. Easy to skim over the code and miss the includes.
I do wish that the SD card example in the Espressif library would remind that the time stamp definitions are set via the Posix libraries. That might only be a simple line or two in the comments for the example.
Easy example of using the Unix/Posix time set...
https://github.com/lbernstone/ESP32_settimeofday/blob/master/settimeofday.ino
Board
Arduino Nano ESP32
Device Description
Arduino Nano ESP32 only
Hardware Configuration
Arduino Nano ESP32 only
Version
v2.0.13
IDE Name
Arduino IDE 2.3.2
Operating System
Windows 11
Flash frequency
Default
PSRAM enabled
yes
Upload speed
Default
Description
Hi,
when I experiment with the IDE 2.3.2 and Arduino Nano ESP32 Core 2.0.13 and example
LittleFS_time
I notice that a current date is not taken from the time server. Compared to the ESP8266 LittleFS , file methods are also missing. For examplefile.getCreationTime()
.Is ESP32 LittleFS still being developed further?
Thanks.
Sketch
Debug Message
Other Steps to Reproduce
.
I have checked existing issues, online documentation and the Troubleshooting Guide