mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-15 06:34:10 +00:00
set boottime for RTC (if rtc is set)
This commit is contained in:
+2
-2
@@ -840,7 +840,7 @@ bool System::loop() {
|
|||||||
void System::send_info_mqtt() {
|
void System::send_info_mqtt() {
|
||||||
static uint8_t _connection = 0;
|
static uint8_t _connection = 0;
|
||||||
uint8_t connection = (EMSESP::network_.ethernet_connected() ? 1 : 0) + (EMSESP::network_.wifi_connected() ? 2 : 0) + (ntp_connected_ ? 4 : 0)
|
uint8_t connection = (EMSESP::network_.ethernet_connected() ? 1 : 0) + (EMSESP::network_.wifi_connected() ? 2 : 0) + (ntp_connected_ ? 4 : 0)
|
||||||
+ (EMSESP::network_.has_ipv6() ? 8 : 0);
|
+ (EMSESP::network_.has_ipv6() ? 8 : 0);
|
||||||
// check if connection status has changed
|
// check if connection status has changed
|
||||||
if (!Mqtt::connected() || connection == _connection) {
|
if (!Mqtt::connected() || connection == _connection) {
|
||||||
return;
|
return;
|
||||||
@@ -853,7 +853,7 @@ void System::send_info_mqtt() {
|
|||||||
|
|
||||||
// if NTP is enabled send the boot_time in local time in ISO 8601 format (eg: 2022-11-15 20:46:38)
|
// if NTP is enabled send the boot_time in local time in ISO 8601 format (eg: 2022-11-15 20:46:38)
|
||||||
// https://github.com/emsesp/EMS-ESP32/issues/751
|
// https://github.com/emsesp/EMS-ESP32/issues/751
|
||||||
if (ntp_connected_) {
|
if (time(nullptr) > 1500000000L) {
|
||||||
char time_string[25];
|
char time_string[25];
|
||||||
time_t now = time(nullptr) - uuid::get_uptime_sec();
|
time_t now = time(nullptr) - uuid::get_uptime_sec();
|
||||||
strftime(time_string, 25, "%FT%T%z", localtime(&now));
|
strftime(time_string, 25, "%FT%T%z", localtime(&now));
|
||||||
|
|||||||
Reference in New Issue
Block a user