Merge pull request #9774 from s-hadinger/start_valid_time

Use START_VALID_TIME
This commit is contained in:
s-hadinger 2020-11-08 10:14:16 +01:00 committed by GitHub
commit 327ca0aa85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -315,7 +315,7 @@ void Z_Device::setLastSeenNow(void) {
// Fixes issue where zigbee device pings before WiFi/NTP has set utc_time
// to the correct time, and "last seen" calculations are based on the
// pre-corrected last_seen time and the since-corrected utc_time.
if (Rtc.utc_time < 1577836800) { return; }
if (Rtc.utc_time < START_VALID_TIME) { return; }
last_seen = Rtc.utc_time;
}

View File

@ -1949,19 +1949,19 @@ void ZCLFrame::autoResponder(const uint16_t *attr_list_ids, size_t attr_len) {
break;
#endif
case 0x000A0000: // Time
attr.setUInt((Rtc.utc_time > (60 * 60 * 24 * 365 * 10)) ? Rtc.utc_time - 946684800 : Rtc.utc_time);
attr.setUInt((Rtc.utc_time > START_VALID_TIME) ? Rtc.utc_time - 946684800 : Rtc.utc_time);
break;
case 0x000AFF00: // TimeEpoch - Tasmota specific
attr.setUInt(Rtc.utc_time);
break;
case 0x000A0001: // TimeStatus
attr.setUInt((Rtc.utc_time > (60 * 60 * 24 * 365 * 10)) ? 0x02 : 0x00); // if time is beyond 2010 then we are synchronized
attr.setUInt((Rtc.utc_time > START_VALID_TIME) ? 0x02 : 0x00);
break;
case 0x000A0002: // TimeZone
attr.setUInt(Settings.toffset[0] * 60);
break;
case 0x000A0007: // LocalTime // TODO take DST
attr.setUInt(Settings.toffset[0] * 60 + ((Rtc.utc_time > (60 * 60 * 24 * 365 * 10)) ? Rtc.utc_time - 946684800 : Rtc.utc_time));
attr.setUInt(Settings.toffset[0] * 60 + ((Rtc.utc_time > START_VALID_TIME) ? Rtc.utc_time - 946684800 : Rtc.utc_time));
break;
}
if (!attr.isNone()) {