1.2.7.4.36 SYS_FS_FileDirectoryTimeSet Function
1.2.7.4.36 C
SYS_FS_RESULT SYS_FS_FileDirectoryTimeSet
(
const char* path,
SYS_FS_TIME *time
);
1.2.7.4.36 Summary
Sets or changes the time for a file or directory.
1.2.7.4.36 Description
This function sets or change the time for a file or directory.
1.2.7.4.36 Precondition
The file/directory for which time is to be set must exist.
1.2.7.4.36 Parameters
| Parameters | Description |
|---|---|
| path | A path for the file/directory, for which the time is to be set |
| ptr | Pointer to the structure of type SYS_FS_TIME, which contains the time data to be set |
1.2.7.4.36 Returns
SYS_FS_RES_SUCCESS - Set time operation was successful.
SYS_FS_RES_FAILURE - Set time operation was unsuccessful. The reason for the failure can be retrieved with SYS_FS_Error.
1.2.7.4.36 Example
void setTime(void) { SYS_FS_RESULT res; SYS_FS_TIME time; time.packedTime = 0; // All FAT FS times are calculated based on 0 = 1980 time.discreteTime.year = (2021 - 1980); // Year is 2021 time.discreteTime.month = 8; // Month (August) time.discreteTime.day = 9; // Day (9) time.discreteTime.hour = 15; // 3 PM time.discreteTime.minute = 06; // 06 minutes time.discreteTime.second = 00; // 00 seconds res = SYS_FS_FileDirectoryTimeSet("file.txt", &time); if( res != SYS_FS_RES_SUCCESS) { // time change has gone wrong } }
1.2.7.4.36 Remarks
None.
