From 2227eb52adb467fe9a70ddbe2c7a72387b6f9bc1 Mon Sep 17 00:00:00 2001 From: German Martin Date: Mon, 1 May 2017 08:39:36 +0200 Subject: [PATCH] Improve uptime calculation --- src/ESPNTPClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ESPNTPClient.cpp b/src/ESPNTPClient.cpp index f3f4842..c6c065f 100644 --- a/src/ESPNTPClient.cpp +++ b/src/ESPNTPClient.cpp @@ -124,8 +124,8 @@ time_t NTPClient::getTime() } getFirstSync(); _lastSyncd = secsSince1970; - if (!_firstSync) { - _firstSync = secsSince1970; + if (!_firstSync) { // first sync is not set + _firstSync = secsSince1970 - getUptime(); DEBUGLOG("First sync! %s\r\n", getTimeDateString(getFirstSync()).c_str()); } DEBUGLOG("Succeccful NTP sync at %s\r\n", getTimeDateString(getLastNTPSync()).c_str());