1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 12:25:20 +03:00

Set the filesystem timestamps of Blackbox files using the local… (#8570)

Set the filesystem timestamps of Blackbox files using the local timezone
This commit is contained in:
Michael Keller 2019-07-25 07:44:31 +12:00 committed by GitHub
commit cd50b35d9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2633,11 +2633,13 @@ static void afatfs_createFileContinue(afatfsFile_t *file)
#ifdef USE_RTC_TIME #ifdef USE_RTC_TIME
// rtcGetDateTime will fill dt with 0000-01-01T00:00:00 // rtcGetDateTime will fill dt with 0000-01-01T00:00:00
// when time is not known. // when time is not known.
dateTime_t dt; dateTime_t dt, local_dt;
rtcGetDateTime(&dt); rtcGetDateTime(&dt);
if (dt.year != 0) { if (dt.year != 0) {
fileDate = FAT_MAKE_DATE(dt.year, dt.month, dt.day); // By tradition, FAT filesystem timestamps use local time.
fileTime = FAT_MAKE_TIME(dt.hours, dt.minutes, dt.seconds); dateTimeUTCToLocal(&dt, &local_dt);
fileDate = FAT_MAKE_DATE(local_dt.year, local_dt.month, local_dt.day);
fileTime = FAT_MAKE_TIME(local_dt.hours, local_dt.minutes, local_dt.seconds);
} }
#endif #endif