NTPClient decode also extern epoch time
overloaded function getDay, getHours, getMinutes and getSeconds with extern epoch time as argument added.
This commit is contained in:
parent
78d4237b3a
commit
a8eab3fc8b
@ -148,6 +148,19 @@ int NTPClient::getMinutes() const {
|
|||||||
int NTPClient::getSeconds() const {
|
int NTPClient::getSeconds() const {
|
||||||
return (this->getEpochTime() % 60);
|
return (this->getEpochTime() % 60);
|
||||||
}
|
}
|
||||||
|
// functions for decode extern epoch time
|
||||||
|
int NTPClient::getDay(unsigned long epochTime) const {
|
||||||
|
return (((epochTime / 86400L) + 4 ) % 7); //0 is Sunday
|
||||||
|
}
|
||||||
|
int NTPClient::getHours(unsigned long epochTime) const {
|
||||||
|
return ((epochTime % 86400L) / 3600);
|
||||||
|
}
|
||||||
|
int NTPClient::getMinutes(unsigned long epochTime) const {
|
||||||
|
return ((epochTime % 3600) / 60);
|
||||||
|
}
|
||||||
|
int NTPClient::getSeconds(unsigned long epochTime) const {
|
||||||
|
return (epochTime % 60);
|
||||||
|
}
|
||||||
|
|
||||||
String NTPClient::getFormattedTime() const {
|
String NTPClient::getFormattedTime() const {
|
||||||
unsigned long rawTime = this->getEpochTime();
|
unsigned long rawTime = this->getEpochTime();
|
||||||
|
@ -85,6 +85,10 @@ class NTPClient {
|
|||||||
int getHours() const;
|
int getHours() const;
|
||||||
int getMinutes() const;
|
int getMinutes() const;
|
||||||
int getSeconds() const;
|
int getSeconds() const;
|
||||||
|
int getDay(unsigned long epochTime) const;
|
||||||
|
int getHours(unsigned long epochTime) const;
|
||||||
|
int getMinutes(unsigned long epochTime) const;
|
||||||
|
int getSeconds(unsigned long epochTime) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the time offset. Useful for changing timezones dynamically
|
* Changes the time offset. Useful for changing timezones dynamically
|
||||||
|
Loading…
Reference in New Issue
Block a user