Skip to content
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

File Creation date wrong #30

Closed
gcharles81 opened this issue Jul 19, 2020 · 3 comments
Closed

File Creation date wrong #30

gcharles81 opened this issue Jul 19, 2020 · 3 comments

Comments

@gcharles81
Copy link

Hello Thanks for this library I am using it in my Aquarium controller project but I have an issue on teh creation date of the files created on the USB somehow the date shows always 31.12.2003 time 23.00 is there a reason for that ?

Thanks
Charles
CH736Scapture

@djuseeq
Copy link
Owner

djuseeq commented Jul 20, 2020

Hi Charles.
I'm glad you can use it, thanks for the star. The default date/time it should be 2004-jan-1, 0h.0m.0s . What is the process during creating the RTCLOG.TXT file? First create and save the file,after set the file name again and open it, using the setYear, setMonth ... functions set the actual date/time, after call saveFileAttrb function and finally close the file. Actually with these functions you change the file "last modified time and date" attributes. Maybe i will add a possibility to choose between create and modified date attributes to change.

@gcharles81
Copy link
Author

Hello Thanks for the Answer , so the solution to that is to use the below functions at startup and always update those with Today`s date ? I have RTC so I can keep thoose updated or I have to update before editing any file ?

      flashDrive.setYear(2019);
      flashDrive.setMonth(12);
      flashDrive.setDay(19);
      flashDrive.setHour(03);
      flashDrive.setMinute(38);
      flashDrive.setSecond(42);

@djuseeq
Copy link
Owner

djuseeq commented Jul 20, 2020

If the file doesn't exist on the drive then first you create it, if there is some data then write it, close the file with this you will create the file on the drive
setFileName(FILENAME); openFile(); writeFile(data, length); closeFile(); this will create the file with the default date 2004-jan-1, 0h.0m.0s
and then open again the file and modify the date
setFileName(FILENAME); openFile(); get the date/time from RTC and use the set functions ; saveFileAttrb(); after these you can close the file or continue to add a next line of data and close it afterwards moveCursor(CURSOREND); writeFile(data, length); closeFile();

@djuseeq djuseeq closed this as completed Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants