File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,19 @@ int NTPClient::getMinutes() const {
148
148
int NTPClient::getSeconds () const {
149
149
return (this ->getEpochTime () % 60 );
150
150
}
151
+ // functions for decode extern epoch time
152
+ int NTPClient::getDay (unsigned long epochTime) const {
153
+ return (((epochTime / 86400L ) + 4 ) % 7 ); // 0 is Sunday
154
+ }
155
+ int NTPClient::getHours (unsigned long epochTime) const {
156
+ return ((epochTime % 86400L ) / 3600 );
157
+ }
158
+ int NTPClient::getMinutes (unsigned long epochTime) const {
159
+ return ((epochTime % 3600 ) / 60 );
160
+ }
161
+ int NTPClient::getSeconds (unsigned long epochTime) const {
162
+ return (epochTime % 60 );
163
+ }
151
164
152
165
String NTPClient::getFormattedTime () const {
153
166
unsigned long rawTime = this ->getEpochTime ();
Original file line number Diff line number Diff line change @@ -85,7 +85,11 @@ class NTPClient {
85
85
int getHours () const ;
86
86
int getMinutes () const ;
87
87
int getSeconds () const ;
88
-
88
+ int getDay (unsigned long epochTime) const ;
89
+ int getHours (unsigned long epochTime) const ;
90
+ int getMinutes (unsigned long epochTime) const ;
91
+ int getSeconds (unsigned long epochTime) const ;
92
+
89
93
/* *
90
94
* Changes the time offset. Useful for changing timezones dynamically
91
95
*/
You can’t perform that action at this time.
0 commit comments