diff --git a/NTPClient.cpp b/NTPClient.cpp index b435855..266fcba 100755 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -136,6 +136,11 @@ unsigned long NTPClient::getEpochTime() const { ((millis() - this->_lastUpdate) / 1000); // Time since last update } +unsigned long NTPClient::getUTCEpochTime() const { + return this->_currentEpoc + // Epoch returned by the NTP server + ((millis() - this->_lastUpdate) / 1000); // Time since last update +} + int NTPClient::getDay() const { return (((this->getEpochTime() / 86400L) + 4 ) % 7); //0 is Sunday } diff --git a/NTPClient.h b/NTPClient.h index a31d32f..deb4f80 100755 --- a/NTPClient.h +++ b/NTPClient.h @@ -107,6 +107,10 @@ class NTPClient { */ unsigned long getEpochTime() const; + /** + * @return time in seconds since Jan. 1, 1970 + */ + unsigned long getUTCEpochTime() const; /** * Stops the underlying UDP client */