Skip to content

Commit

Permalink
Changing long into unsigned int
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi Gubello committed Sep 3, 2020
1 parent 9e4323b commit f567329
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions NTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void NTPClient::begin() {
this->begin(NTP_DEFAULT_LOCAL_PORT);
}

void NTPClient::begin(long port) {
void NTPClient::begin(unsigned int port) {
this->_port = port;

this->_udp->begin(this->_port);
Expand Down Expand Up @@ -181,7 +181,7 @@ void NTPClient::sendNTPPacket() {
// set all bytes in the buffer to 0
memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
// (see URL above for details on the packets) Serial.println(this->_port);
// (see URL above for details on the packets)

this->_packetBuffer[0] = 0b11100011; // LI, Version, Mode
this->_packetBuffer[1] = 0; // Stratum, or type of clock
Expand All @@ -204,7 +204,7 @@ void NTPClient::sendNTPPacket() {
this->_udp->endPacket();
}

void NTPClient::setRandomPort(long minValue, long maxValue) {
void NTPClient::setRandomPort(unsigned int minValue, unsigned int maxValue) {
randomSeed(analogRead(0));
this->_port = random(minValue, maxValue);
}
6 changes: 3 additions & 3 deletions NTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NTPClient {

const char* _poolServerName = "pool.ntp.org"; // Default time server
IPAddress _poolServerIP;
long _port = NTP_DEFAULT_LOCAL_PORT;
unsigned int _port = NTP_DEFAULT_LOCAL_PORT;
long _timeOffset = 0;

unsigned long _updateInterval = 60000; // In ms
Expand Down Expand Up @@ -47,7 +47,7 @@ class NTPClient {
/**
* Set random local port
*/
void setRandomPort(long minValue, long maxValue);
void setRandomPort(unsigned int minValue, unsigned int maxValue);

/**
* Starts the underlying UDP client with the default local port
Expand All @@ -57,7 +57,7 @@ class NTPClient {
/**
* Starts the underlying UDP client with the specified local port
*/
void begin(long port);
void begin(unsigned int port);

/**
* This should be called in the main loop of your application. By default an update from the NTP Server is only
Expand Down

0 comments on commit f567329

Please sign in to comment.