Rename getRawTime to getEpochTime
This commit is contained in:
parent
b0776ef19c
commit
9229123274
@ -101,27 +101,27 @@ bool NTPClient::update() {
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned long NTPClient::getRawTime() {
|
||||
unsigned long NTPClient::getEpochTime() {
|
||||
return this->_timeOffset + // User offset
|
||||
this->_currentEpoc + // Epoc returned by the NTP server
|
||||
((millis() - this->_lastUpdate) / 1000); // Time since last update
|
||||
}
|
||||
|
||||
String NTPClient::getDay() {
|
||||
return String(((this->getRawTime() / 86400L) + 4 ) % 7); //0 is Sunday
|
||||
return String(((this->getEpochTime() / 86400L) + 4 ) % 7); //0 is Sunday
|
||||
}
|
||||
String NTPClient::getHours() {
|
||||
return String((this->getRawTime() % 86400L) / 3600);
|
||||
return String((this->getEpochTime() % 86400L) / 3600);
|
||||
}
|
||||
String NTPClient::getMinutes() {
|
||||
return String((this->getRawTime() % 3600) / 60);
|
||||
return String((this->getEpochTime() % 3600) / 60);
|
||||
}
|
||||
String NTPClient::getSeconds() {
|
||||
return String(this->getRawTime() % 60);
|
||||
return String(this->getEpochTime() % 60);
|
||||
}
|
||||
|
||||
String NTPClient::getFormattedTime() {
|
||||
unsigned long rawTime = this->getRawTime();
|
||||
unsigned long rawTime = this->getEpochTime();
|
||||
unsigned long hours = (rawTime % 86400L) / 3600;
|
||||
String hoursStr = hours < 10 ? "0" + String(hours) : String(hours);
|
||||
|
||||
|
@ -69,9 +69,9 @@ class NTPClient {
|
||||
String getFormattedTime();
|
||||
|
||||
/**
|
||||
* @return time as raw seconds
|
||||
* @return time in seconds since Jan. 1, 1970
|
||||
*/
|
||||
unsigned long getRawTime();
|
||||
unsigned long getEpochTime();
|
||||
|
||||
/**
|
||||
* Stops the underlying UDP client
|
||||
|
@ -17,4 +17,4 @@ getHours KEYWORD2
|
||||
getMinutes KEYWORD2
|
||||
getSeconds KEYWORD2
|
||||
getFormattedTime KEYWORD2
|
||||
getRawTime KEYWORD2
|
||||
getEpochTime KEYWORD2
|
||||
|
Loading…
Reference in New Issue
Block a user