From 6bb8cdafc703c9459f89cc7aa00ddb949acab421 Mon Sep 17 00:00:00 2001 From: Peeter Normak Date: Tue, 31 Oct 2017 11:01:47 +0200 Subject: [PATCH] added method for changing time server --- NTPClient.cpp | 4 ++++ NTPClient.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/NTPClient.cpp b/NTPClient.cpp index a26747b..87b7a53 100644 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -148,6 +148,10 @@ void NTPClient::setUpdateInterval(unsigned long updateInterval) { this->_updateInterval = updateInterval; } +void NTPClient::setPoolServerName(const char* poolServerName) { + this->_poolServerName = poolServerName; +} + void NTPClient::sendNTPPacket() { // set all bytes in the buffer to 0 memset(this->_packetBuffer, 0, NTP_PACKET_SIZE); diff --git a/NTPClient.h b/NTPClient.h index a99c7e0..02d8752 100644 --- a/NTPClient.h +++ b/NTPClient.h @@ -33,6 +33,13 @@ class NTPClient { NTPClient(UDP& udp, const char* poolServerName, long timeOffset); NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval); + /** + * Set time server name + * + * @param poolServerName + */ + void setPoolServerName(const char* poolServerName); + /** * Starts the underlying UDP client with the default local port */