Update NTPClient.cpp
This commit is contained in:
parent
15252fa538
commit
24e070ab27
@ -135,6 +135,14 @@ unsigned long NTPClient::getEpochTime() const {
|
|||||||
int NTPClient::getDay() const {
|
int NTPClient::getDay() const {
|
||||||
return (((this->getEpochTime() / 86400L) + 4 ) % 7); //0 is Sunday
|
return (((this->getEpochTime() / 86400L) + 4 ) % 7); //0 is Sunday
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NTPClient::getDayOfMonth() const {
|
||||||
|
time_t rawtime = this->getEpochTime() ;
|
||||||
|
struct tm * ti;
|
||||||
|
ti = localtime (&rawtime);
|
||||||
|
return ti->tm_mday; // day of month
|
||||||
|
}
|
||||||
|
|
||||||
int NTPClient::getHours() const {
|
int NTPClient::getHours() const {
|
||||||
return ((this->getEpochTime() % 86400L) / 3600);
|
return ((this->getEpochTime() % 86400L) / 3600);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user