From 6d0d9231633a021d41f5b3a73148a8e51e3c2f1a Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sun, 8 Nov 2020 09:38:34 +0100 Subject: [PATCH] Use START_VALID_TIME --- tasmota/xdrv_23_zigbee_2a_devices_impl.ino | 2 +- tasmota/xdrv_23_zigbee_8_parsers.ino | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasmota/xdrv_23_zigbee_2a_devices_impl.ino b/tasmota/xdrv_23_zigbee_2a_devices_impl.ino index d94c54e0b..20abe848a 100644 --- a/tasmota/xdrv_23_zigbee_2a_devices_impl.ino +++ b/tasmota/xdrv_23_zigbee_2a_devices_impl.ino @@ -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; } diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index ba99e5e79..9753b5a3c 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -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()) {