mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Fix RTC local time formatting (timezone offset) when no valid d… (#8731)
Fix RTC local time formatting (timezone offset) when no valid date/time
This commit is contained in:
commit
cbe8749d69
2 changed files with 5 additions and 4 deletions
|
@ -1187,15 +1187,15 @@ static bool sendFieldDefinition(char mainFrameChar, char deltaFrameChar, const v
|
||||||
// Buf must be at least FORMATTED_DATE_TIME_BUFSIZE
|
// Buf must be at least FORMATTED_DATE_TIME_BUFSIZE
|
||||||
STATIC_UNIT_TESTED char *blackboxGetStartDateTime(char *buf)
|
STATIC_UNIT_TESTED char *blackboxGetStartDateTime(char *buf)
|
||||||
{
|
{
|
||||||
#ifdef USE_RTC_TIME
|
#ifdef USE_RTC_TIME
|
||||||
dateTime_t dt;
|
dateTime_t dt;
|
||||||
// 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.
|
||||||
rtcGetDateTime(&dt);
|
rtcGetDateTime(&dt);
|
||||||
dateTimeFormatLocal(buf, &dt);
|
dateTimeFormatLocal(buf, &dt);
|
||||||
#else
|
#else
|
||||||
buf = "0000-01-01T00:00:00.000";
|
buf = "0000-01-01T00:00:00.000";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,8 @@ bool dateTimeFormatUTC(char *buf, dateTime_t *dt)
|
||||||
|
|
||||||
bool dateTimeFormatLocal(char *buf, dateTime_t *dt)
|
bool dateTimeFormatLocal(char *buf, dateTime_t *dt)
|
||||||
{
|
{
|
||||||
return dateTimeFormat(buf, dt, timeConfig()->tz_offsetMinutes, false);
|
const int16_t timezoneOffset = rtcIsDateTimeValid(dt) ? timeConfig()->tz_offsetMinutes : 0;
|
||||||
|
return dateTimeFormat(buf, dt, timezoneOffset, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dateTimeFormatLocalShort(char *buf, dateTime_t *dt)
|
bool dateTimeFormatLocalShort(char *buf, dateTime_t *dt)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue