9 years, 11 months ago.

geting timestamp for files written in SD card

Hi, I am writing some txt files into SD card. When I check it on pc, the file's 'created time' is always 01/01/2098, I want this to be as per the date (I am getting timestamp using GSM Module). Can any one help me on figuring this out. Thanks in Advance, Regards, fD

1 Answer

9 years, 11 months ago.

You need to use the real time clock ,look at :
http://developer.mbed.org/users/roen/notebook/real-time/
http://developer.mbed.org/questions/2431/How-to-set-Date-and-Time-of-SD-file/
rtc_time.h
rtc_api.h
Hope this can help

Thanks Robert, I got the RTC running now but still no clue how to set time for SD card files. Is there any command that can set time (using rtc) for SD files. Hope you will answer this soon. thanks again in advance Regards - fD

posted by Fahd Ansary 04 Dec 2014

This is what I did, with a Mbed 1768 and the Codesourcery offline compiler . 1) import the SDFileSystem found in the Mbed handbook. I import this as a program (to change the source :make the SPI public ) 2) check the FatFilesystem.cpp , it uses the RTC, look at get_fattime(void) When you create a file, the the creation date is the date from RTC...nothing to do ! You can read this file date on your PC but not with the mbed sd interface ! Robert

posted by Robert Spilleboudt 04 Dec 2014