From 394e8839bc4888a6671398a90294e75a3c1f6ac9 Mon Sep 17 00:00:00 2001 From: Riccardo Paolo Bestetti Date: Wed, 28 May 2025 14:26:53 +0200 Subject: [PATCH] Add function 'setPoolServerIP' like 'setPoolServerName' --- NTPClient.cpp | 5 +++++ NTPClient.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/NTPClient.cpp b/NTPClient.cpp index b435855..675c728 100755 --- a/NTPClient.cpp +++ b/NTPClient.cpp @@ -181,6 +181,11 @@ void NTPClient::setPoolServerName(const char* poolServerName) { this->_poolServerName = poolServerName; } +void NTPClient::setPoolServerIP(IPAddress poolServerIP) { + this->_poolServerIP = poolServerIP; + this->_poolServerName = NULL; +} + 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 a31d32f..4acf5f8 100755 --- a/NTPClient.h +++ b/NTPClient.h @@ -44,6 +44,11 @@ class NTPClient { */ void setPoolServerName(const char* poolServerName); + /** + * Set time server IP address + */ + void setPoolServerIP(IPAddress poolServerIP); + /** * Set random local port */