Target
- TI MCU platform (e.g., AM64x/AM243x series)
- ffconfigTIME_SUPPORT = 1
FF_GetSystemTime() implemented and verified to return correct system time
Summary
When appending or modifying a file, FF_Close() does not update xOriginalEntry.xModifiedTime (or xDirEntry.xModifiedTime) with the current system time, even though ffconfigTIME_SUPPORT = 1 and
FF_GetSystemTime() is correctly implemented.
As a result, the FAT directory entry's “last modified timestamp” does not change on file close unless the modified time was manually updated earlier in the write path.
This behavior seems unintended, because FF_PutEntry() simply writes the existing xModifiedTime value into the directory entry without refreshing it.
Reproduction steps
- Open a file in append or write mode:
FF_FILE *fp = ff_fopen("/file.txt", "a");
Proposed Fix
The root cause is that neither FF_Close() nor FF_PutEntry() updates xOriginalEntry.xModifiedTime (or pxDirEntry->xModifiedTime) to the current system time before storing the directory entry.
To ensure correct FAT "last modified timestamp" behavior, the modified time must be refreshed immediately before the directory entry is written back.
Target
FF_GetSystemTime()implemented and verified to return correct system timeSummary
When appending or modifying a file,
FF_Close()does not updatexOriginalEntry.xModifiedTime(orxDirEntry.xModifiedTime) with the current system time, even thoughffconfigTIME_SUPPORT = 1andFF_GetSystemTime()is correctly implemented.As a result, the FAT directory entry's “last modified timestamp” does not change on file close unless the modified time was manually updated earlier in the write path.
This behavior seems unintended, because
FF_PutEntry()simply writes the existingxModifiedTimevalue into the directory entry without refreshing it.Reproduction steps
Proposed Fix
The root cause is that neither
FF_Close()norFF_PutEntry()updatesxOriginalEntry.xModifiedTime(orpxDirEntry->xModifiedTime) to the current system time before storing the directory entry.To ensure correct FAT "last modified timestamp" behavior, the modified time must be refreshed immediately before the directory entry is written back.