Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions NTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down