Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 3 months ago.
[os 2] Can the date of a SD-Card file be changed?
Hello all,
I'm using SD File System to create a *.csv file with some data. After a while I'm getting a timestamp from GPS readings and I would like to update the properties of my file (creation or modification date - whatever).
Is it possible and how should I approach this problem?
1 Answer
7 years, 3 months ago.
Assuming you're using the latest filesystem - https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/storage/filesystem/
It should have hooks into the RTC, so you can use the set_time function to set the time of the RTC, then any files written will have reflect that. Here is a reference for the set_time function - https://docs.mbed.com/docs/mbed-os-api-reference/en/latest/APIs/tasks/Time/.
I've tested it with the mbed OS file system example, and it worked - https://github.com/ARMmbed/mbed-os-example-fat-filesystem