File tree 2 files changed +12
-12
lines changed
2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -101,26 +101,26 @@ bool NTPClient::update() {
101
101
return true ;
102
102
}
103
103
104
- unsigned long NTPClient::getEpochTime () {
104
+ unsigned long NTPClient::getEpochTime () const {
105
105
return this ->_timeOffset + // User offset
106
106
this ->_currentEpoc + // Epoc returned by the NTP server
107
107
((millis () - this ->_lastUpdate ) / 1000 ); // Time since last update
108
108
}
109
109
110
- int NTPClient::getDay () {
110
+ int NTPClient::getDay () const {
111
111
return (((this ->getEpochTime () / 86400L ) + 4 ) % 7 ); // 0 is Sunday
112
112
}
113
- int NTPClient::getHours () {
113
+ int NTPClient::getHours () const {
114
114
return ((this ->getEpochTime () % 86400L ) / 3600 );
115
115
}
116
- int NTPClient::getMinutes () {
116
+ int NTPClient::getMinutes () const {
117
117
return ((this ->getEpochTime () % 3600 ) / 60 );
118
118
}
119
- int NTPClient::getSeconds () {
119
+ int NTPClient::getSeconds () const {
120
120
return (this ->getEpochTime () % 60 );
121
121
}
122
122
123
- String NTPClient::getFormattedTime () {
123
+ String NTPClient::getFormattedTime () const {
124
124
unsigned long rawTime = this ->getEpochTime ();
125
125
unsigned long hours = (rawTime % 86400L ) / 3600 ;
126
126
String hoursStr = hours < 10 ? " 0" + String (hours) : String (hours);
Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ class NTPClient {
58
58
*/
59
59
bool forceUpdate ();
60
60
61
- int getDay ();
62
- int getHours ();
63
- int getMinutes ();
64
- int getSeconds ();
61
+ int getDay () const ;
62
+ int getHours () const ;
63
+ int getMinutes () const ;
64
+ int getSeconds () const ;
65
65
66
66
/* *
67
67
* Changes the time offset. Useful for changing timezones dynamically
@@ -77,12 +77,12 @@ class NTPClient {
77
77
/* *
78
78
* @return time formatted like `hh:mm:ss`
79
79
*/
80
- String getFormattedTime ();
80
+ String getFormattedTime () const ;
81
81
82
82
/* *
83
83
* @return time in seconds since Jan. 1, 1970
84
84
*/
85
- unsigned long getEpochTime ();
85
+ unsigned long getEpochTime () const ;
86
86
87
87
/* *
88
88
* Stops the underlying UDP client
You can’t perform that action at this time.
0 commit comments