Update NTPClient.cpp

This commit is contained in:
RITZ 2020-10-07 14:54:48 +02:00 committed by GitHub
parent 15252fa538
commit 24e070ab27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,6 +135,14 @@ unsigned long NTPClient::getEpochTime() const {
int NTPClient::getDay() const {
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 {
return ((this->getEpochTime() % 86400L) / 3600);
}