Skip to content

Commit f567329

Browse files
author
Luigi Gubello
committed
Changing long into unsigned int
1 parent 9e4323b commit f567329

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

NTPClient.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void NTPClient::begin() {
7373
this->begin(NTP_DEFAULT_LOCAL_PORT);
7474
}
7575

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

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

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

207-
void NTPClient::setRandomPort(long minValue, long maxValue) {
207+
void NTPClient::setRandomPort(unsigned int minValue, unsigned int maxValue) {
208208
randomSeed(analogRead(0));
209209
this->_port = random(minValue, maxValue);
210210
}

NTPClient.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class NTPClient {
1515

1616
const char* _poolServerName = "pool.ntp.org"; // Default time server
1717
IPAddress _poolServerIP;
18-
long _port = NTP_DEFAULT_LOCAL_PORT;
18+
unsigned int _port = NTP_DEFAULT_LOCAL_PORT;
1919
long _timeOffset = 0;
2020

2121
unsigned long _updateInterval = 60000; // In ms
@@ -47,7 +47,7 @@ class NTPClient {
4747
/**
4848
* Set random local port
4949
*/
50-
void setRandomPort(long minValue, long maxValue);
50+
void setRandomPort(unsigned int minValue, unsigned int maxValue);
5151

5252
/**
5353
* Starts the underlying UDP client with the default local port
@@ -57,7 +57,7 @@ class NTPClient {
5757
/**
5858
* Starts the underlying UDP client with the specified local port
5959
*/
60-
void begin(long port);
60+
void begin(unsigned int port);
6161

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

0 commit comments

Comments
 (0)