Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setPoolServerIP and setPoolServerAddress methods #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions NTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,20 @@ void NTPClient::setPoolServerName(const char* poolServerName) {
this->_poolServerName = poolServerName;
}

void NTPClient::setPoolServerIP(IPAddress poolServerIP) {
this->_poolServerIP = poolServerIP;
this->_poolServerName = NULL;
}

void NTPClient::setPoolServerAddress(const char* poolServerAddress) {
this->_poolServerName = poolServerAddress;
}

void NTPClient::setPoolServerAddress(IPAddress poolServerAddress) {
this->_poolServerIP = poolServerAddress;
this->_poolServerName = NULL;
}

void NTPClient::sendNTPPacket() {
// set all bytes in the buffer to 0
memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);
Expand Down
15 changes: 15 additions & 0 deletions NTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ class NTPClient {
* @param poolServerName
*/
void setPoolServerName(const char* poolServerName);

/**
* Set time server IP address
*
* @param poolServerIP
*/
void setPoolServerIP(IPAddress poolServerIP);

/**
* Set time server domain or IP address
*
* @param poolServerAddress
*/
void setPoolServerAddress(const char* poolServerAddress);
void setPoolServerAddress(IPAddress poolServerAddress);

/**
* Starts the underlying UDP client with the default local port
Expand Down