From 15252fa538d35b2078883c664b16ed9a8409ecd6 Mon Sep 17 00:00:00 2001 From: RITZ Date: Wed, 7 Oct 2020 14:50:45 +0200 Subject: [PATCH 1/3] Update NTPClient.h --- NTPClient.h | 1 + 1 file changed, 1 insertion(+) diff --git a/NTPClient.h b/NTPClient.h index b518c28..5cc6c93 100755 --- a/NTPClient.h +++ b/NTPClient.h @@ -75,6 +75,7 @@ class NTPClient { bool forceUpdate(); int getDay() const; + int getDayOfMonth(); int getHours() const; int getMinutes() const; int getSeconds() const; From 24e070ab27b0de5f157124c8183019abc9bc199d Mon Sep 17 00:00:00 2001 From: RITZ Date: Wed, 7 Oct 2020 14:54:48 +0200 Subject: [PATCH 2/3] 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 +} From 0b68210eae69a0853de15ad84b04d178d04c556f Mon Sep 17 00:00:00 2001 From: RITZ Date: Wed, 7 Oct 2020 14:59:37 +0200 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 6a082d5..06bd671 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Added function to get dayof month - 2020.10.07 + NTPClient 3.1.0 - 2016.05.31 * Added functions for changing the timeOffset and updateInterval later. Thanks @SirUli