Skip to content

Commit 20bcfe4

Browse files
committed
Add end() API
1 parent 5eff0bd commit 20bcfe4

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

NTPClient.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ String NTPClient::getFormattedTime() {
128128
return hoursStr + ":" + minuteStr + ":" + secondStr;
129129
}
130130

131+
void NTPClient::end() {
132+
this->_udp->stop();
133+
}
134+
131135
void NTPClient::sendNTPPacket() {
132136
// set all bytes in the buffer to 0
133137
memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);

NTPClient.h

+5
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ class NTPClient {
6767
* @return time as raw seconds
6868
*/
6969
unsigned long getRawTime();
70+
71+
/**
72+
* Stops the underlying UDP client
73+
*/
74+
void end();
7075
};

keywords.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ NTPClient KEYWORD1
99
#######################################
1010

1111
begin KEYWORD2
12+
end KEYWORD2
1213
update KEYWORD2
1314
forceUpdate KEYWORD2
1415
getDay KEYWORD2

0 commit comments

Comments
 (0)