Skip to content

Commit

Permalink
Improve uptime calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmag11 committed May 1, 2017
1 parent c5ec463 commit 2227eb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ESPNTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 2227eb5

Please sign in to comment.