6 years, 8 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

6 years, 8 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

Accepted Answer

It seems to work like a charm (despite using some older version of 2.0 library), thank you!

posted by Jakub K 16 Aug 2017