Skip to content

Commit 70d6ec4

Browse files
koshatulsandeepmistry
authored andcommitted
Changed timeOffset from int to long to support timezones with more than 32000 seconds difference from GMT (eg, Australia +10 (36000)) (#42)
1 parent 126ea30 commit 70d6ec4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

NTPClient.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ NTPClient::NTPClient(UDP& udp) {
2525
this->_udp = &udp;
2626
}
2727

28-
NTPClient::NTPClient(UDP& udp, int timeOffset) {
28+
NTPClient::NTPClient(UDP& udp, long timeOffset) {
2929
this->_udp = &udp;
3030
this->_timeOffset = timeOffset;
3131
}
@@ -35,13 +35,13 @@ NTPClient::NTPClient(UDP& udp, const char* poolServerName) {
3535
this->_poolServerName = poolServerName;
3636
}
3737

38-
NTPClient::NTPClient(UDP& udp, const char* poolServerName, int timeOffset) {
38+
NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset) {
3939
this->_udp = &udp;
4040
this->_timeOffset = timeOffset;
4141
this->_poolServerName = poolServerName;
4242
}
4343

44-
NTPClient::NTPClient(UDP& udp, const char* poolServerName, int timeOffset, unsigned long updateInterval) {
44+
NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval) {
4545
this->_udp = &udp;
4646
this->_timeOffset = timeOffset;
4747
this->_poolServerName = poolServerName;

NTPClient.h

Lines changed: 4 additions & 4 deletions
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
int _port = NTP_DEFAULT_LOCAL_PORT;
18-
int _timeOffset = 0;
18+
long _timeOffset = 0;
1919

2020
unsigned long _updateInterval = 60000; // In ms
2121

@@ -28,10 +28,10 @@ class NTPClient {
2828

2929
public:
3030
NTPClient(UDP& udp);
31-
NTPClient(UDP& udp, int timeOffset);
31+
NTPClient(UDP& udp, long timeOffset);
3232
NTPClient(UDP& udp, const char* poolServerName);
33-
NTPClient(UDP& udp, const char* poolServerName, int timeOffset);
34-
NTPClient(UDP& udp, const char* poolServerName, int timeOffset, unsigned long updateInterval);
33+
NTPClient(UDP& udp, const char* poolServerName, long timeOffset);
34+
NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval);
3535

3636
/**
3737
* Starts the underlying UDP client with the default local port

0 commit comments

Comments
 (0)