-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
SD file system, request to add file.CreationDate (). #6992
Comments
I tried to mirror the ESP32's One option in the meantime is to use the SdFat library directly and bypass the Arduino core File stuff altogether. I haven't tried it, but no changes were made to the SDFat lib from Greiman except for compatibility changes to the low-level interfaces in my fork. |
My knowledge of the C ++ programming language is too limited to come up with a solution myself. I have now added the code from my program which shows the date. |
Just probably found the solution in the sdFat examples of the ESP8266SdFat library. |
Yes, the actual addition isn't a big deal. We already have enough info to get it with the existing code. I checked the ESP32 and they don't have such a call, but that's not to say we can't. Let me see if I can throw something together tonight. |
For SDFS and LittleFS, enable a creation time accessor for files and Dir iterators, similar to the existing fileTime/getLastWrite calls. Remove spurious Dir::getLastWrite method (the proper and only documented way is really Dir::fileTime). Update json to point to new mklittlefs which copies the creation date of files to the image. Fixes esp8266#6992
I'm going to see if I succeed. |
Unfortunately this would be my first time that I would have to replace a cpp file in a library with a test version. |
Instruction is not yet in line with what I see on my screen. |
I manually transferred the source codes of 7 files to my PC via PR # 7000. I have looked at the source code of SDFS.h and it includes the change from PR #6985. Unfortunately it doesn't work. Debug Messages
|
I tried on my own system and SD create/write stamps are looking good and matching what my Linux box reports for the same SD card, so I think we're good. |
Do you mean that the dates written on the sd via your Linux computer are also visible via the arduino? In my opinion, the problem is not to show the written date stamps. WRONG: (LittleFS with the same program gives correct date/time stamps) |
I took my 128MB card with old photos and ran the modified listfiles example. Compared the create/write times to the ones returned from |
Sorry but I think a modified list files example does NOT change a creation date or lastWrite date. I used the example LittleFS_Timestamp and changed all code LittleFS to SDFS. Don't forget to remove SDFS.format (); |
@NicoZuid , I just pushed an update to #7000 which I was able to test. I was setting a callback for date/time, but never telling the Just make sure that NTP is configured and running before you do file ops (same as other filesystems, of course!) and then you should get the proper dates on all files made on the device, now. Example file created/written on the 8266:
|
@earlephilhower , This morning (CET 7:25 AM) I tested the new version, I can confirm that it now works correctly. _Listing directory: /
FILE: hello.txt SIZE: 13 CREATION: 2020-01-20 07:27:24
LAST WRITE: 2020-01-20 07:27:28_ I always use TimeLib.h in my programs (instead of time.h) while (year(time(NULL)) < 2020) {
delay(500);
Serial.print(".");
} |
* Add fileCreation/getCreation create-time accessors For SDFS and LittleFS, enable a creation time accessor for files and Dir iterators, similar to the existing fileTime/getLastWrite calls. Remove spurious Dir::getLastWrite method (the proper and only documented way is really Dir::fileTime). Update json to point to new mklittlefs which copies the creation date of files to the image. Fixes #6992 * Remove malloc(), use stack vars for temp names LFS filenames are limited in size and generally very small. Use a stack variable instead of a dynamic allocation when performing full-path computations. * Replace "Creation" w/"CreationTime" in FS accessor Per review, `getCreation` -> `getCreationTime`, `fileCreation` -> `fileCreationTime`. The names `fileTime()` and `getLastWrite()` are inherited from ESP32 implementation and unchanged. * Add creation time to listfiles SD example * Enable SdFat's sateTime callback for timestamping SdFat requries the dateTimeCallback call (global for everything) to update dates and times on created files. Because the callback signature doesn't have space for us to provide any parameters, we cannot get the the File, Dir, or FS object's dateTimeCB member. Instead, just go with `time(null)` as the callback function which is right in all but the most esoteric cases. * Correct DOS year/month offset in dateTime callback * Fix docs to match new xxxCreationTime() API names Co-authored-by: Develo <deveyes@gmail.com>
In version 2.5.0 was a directory of utilities included.
A few years ago I found an example on the internet that made it possible to make the creation date of an SD file visible.
In version 2.6.3, Arduino SdFat Library by William Greiman is still used. (2009)
..\2.6.3\librarie\ESP8266\SdFat\src\Fatlib\FatFile.cpp
This file contains code to process the SD file creation date / time.
Is it possible to add this to the options of the SDFS library?
The text was updated successfully, but these errors were encountered: