T3.6 RTC setting file Date and time in SD card

Status
Not open for further replies.

ol boy

Member
I think I have the RTS sorted and its reporting the correct date and time each time I check it. I'm now trying to create a CSV file in the SD card and want to set the date and time for the created file. In SdFile.cpp>>>

Code:
uint8_t SdFile::timestamp(uint8_t flags, uint16_t year, uint8_t month,
         uint8_t day, uint8_t hour, uint8_t minute, uint8_t second) {

This is why i tried the "file.timestamp(T_CREATE,rtcyear,rtcmonth,rtcday,rtchour,rtcminute,rtcsecond);"

Code:
void doDTS(){
rtcyear = year();
rtcmonth = month();
rtcday = day();
rtchour = hour();
rtcminute = minute();
rtcsecond = second();

}


if (!file.open(fileName, O_CREAT | O_WRITE | O_EXCL)) {
    doDTS();
    file.timestamp(T_CREATE,rtcyear,rtcmonth,rtcday,rtchour,rtcminute,rtcsecond);
        
     }

Any guidance would be great as to why it's not setting the date and time.

Thanks Ryan
 
It's been a year since I last looked at it, but I seem to remember the SD library calls the time function as a "Callback". That means any time it creates/updates/closes/syncs a file, it calls the function you provide to give it a time for that operation. You don't directly set any time on the file. The library sets the created/modified dates depending on which operation you are doing.
 
Status
Not open for further replies.
Back
Top