Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

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

  1. #1
    Junior Member
    Join Date
    Jul 2018

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

    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>>>

    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,r tchour,rtcminute,rtcsecond);"

    void doDTS(){
    rtcyear = year();
    rtcmonth = month();
    rtcday = day();
    rtchour = hour();
    rtcminute = minute();
    rtcsecond = second();
    if (!, O_CREAT | O_WRITE | O_EXCL)) {
    Any guidance would be great as to why it's not setting the date and time.

    Thanks Ryan

  2. #2
    Member MorganS's Avatar
    Join Date
    Apr 2015
    Northern Nevada
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts