-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add time and date to FS filesystem API #6311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There was a PR that enabled date/time for spiffs, but I think it was compile time. |
Yes, it was incompatible w/existing code I think. My question/worry has to do with the API, how it's actually set/called. SDFat has a callback you set per-file that gets called when it needs the time/date. That might be the sanest to implement (and be no-op for spiffs/littlefs until they're tweaked) with a default CB applied that takes the current time from |
My PR for SPIFFS is planned for 3.0 due to backward compatibility, but littleFS is not yet in any release, so why to wait for 3.0 to implement date/time for littleFS which is may be in years ? I did not digged in latest LittleFS code yet to see the impact, but feature is definitly there : littlefs-project/littlefs#31 (comment) There is no backward compatibility for littlefs issue yet, I think it would be better to add it now IMHO Also if implementation is done like in ESP32 (SD/SPIFFS/Fat), from user point of view the API has only one function : https://github.com/espressif/arduino-esp32/blob/master/libraries/FS/src/FSImpl.h#L40 |
I like the idea, @luc-github. What about setting the time on a file on the ESP32, is it automatic (i.e. the FS just calls |
On ESP32 I did 2 PR : one on IDF espressif/esp-idf#1128 to prepare the one for Arduino espressif/arduino-esp32#738 because time is set in idf part |
For FATFS, file time is also set from |
Closing as a won't-fix due to SPIFFS. LittleFS and SDFS both have file-time support already. |
#6276 brought it up, but it's a more general concern. If we can solve the general problem then we don't need to do ugly hacks to pull out underlying, wrapped objects for users.
What is the proper way to enable timestamps through the existing FS interface. Setting a file's create/access/write time (as appropriate and available) on creation, at other times, and getting those values from the FS?
SDFat has a global dateTimeCallback() which returns two
uint16_t
s in a very MSDOS-specific format, which is called by the underlying FS library when it needs to get a date/time:https://github.com/greiman/SdFat/blob/master/examples/Timestamp/Timestamp.ino
The old Arduino SD.h fork also exposed these.
SPIFFS and LittleFS might be able to be extended to have date/time metadata, as well, so this should also be generally applicable.
@devyte, @me-no-dev , @d-a-v, any ideas, suggestions?
The text was updated successfully, but these errors were encountered: