1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Fix for the bug projectkk2glider noticed, thanks!

This commit is contained in:
bsongis 2015-02-20 23:03:26 +01:00
parent 01e6c60cf5
commit 0886873f54

View file

@ -70,10 +70,14 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t newVal, uin
if (g_eeGeneral.adjustRTC) { if (g_eeGeneral.adjustRTC) {
struct gtm t; struct gtm t;
gettime(&t); gettime(&t);
t.tm_hour = datetime.hour; if (abs((t.tm_hour-datetime.hour)*3600 + (t.tm_min-datetime.min)*60 + (t.tm_sec-datetime.sec)) > 20) {
t.tm_min = datetime.min; // we adjust RTC only if difference is > 20 seconds
t.tm_sec = datetime.sec; t.tm_hour = datetime.hour;
rtcSetTime(&t); t.tm_min = datetime.min;
t.tm_sec = datetime.sec;
g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated
rtcSetTime(&t);
}
} }
} }
if (datetime.year == 0) { if (datetime.year == 0) {