From 24e070ab27b0de5f157124c8183019abc9bc199d Mon Sep 17 00:00:00 2001 From: RITZ Date: Wed, 7 Oct 2020 14:54:48 +0200 Subject: [PATCH] Update NTPClient.cpp --- NTPClient.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/NTPClient.cpp b/NTPClient.cpp index 760e142..02bc083 100755 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -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); } @@ -207,4 +215,4 @@ void NTPClient::sendNTPPacket() { void NTPClient::setRandomPort(unsigned int minValue, unsigned int maxValue) { randomSeed(analogRead(0)); this->_port = random(minValue, maxValue); -} \ No newline at end of file +}