Changed timeOffset from int to long to support timezones with more than 32000 seconds difference from GMT (eg, Australia +10 (36000)) (#42)
This commit is contained in:
parent
126ea3093b
commit
70d6ec4e90
@ -25,7 +25,7 @@ NTPClient::NTPClient(UDP& udp) {
|
|||||||
this->_udp = &udp;
|
this->_udp = &udp;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTPClient::NTPClient(UDP& udp, int timeOffset) {
|
NTPClient::NTPClient(UDP& udp, long timeOffset) {
|
||||||
this->_udp = &udp;
|
this->_udp = &udp;
|
||||||
this->_timeOffset = timeOffset;
|
this->_timeOffset = timeOffset;
|
||||||
}
|
}
|
||||||
@ -35,13 +35,13 @@ NTPClient::NTPClient(UDP& udp, const char* poolServerName) {
|
|||||||
this->_poolServerName = poolServerName;
|
this->_poolServerName = poolServerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTPClient::NTPClient(UDP& udp, const char* poolServerName, int timeOffset) {
|
NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset) {
|
||||||
this->_udp = &udp;
|
this->_udp = &udp;
|
||||||
this->_timeOffset = timeOffset;
|
this->_timeOffset = timeOffset;
|
||||||
this->_poolServerName = poolServerName;
|
this->_poolServerName = poolServerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTPClient::NTPClient(UDP& udp, const char* poolServerName, int timeOffset, unsigned long updateInterval) {
|
NTPClient::NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval) {
|
||||||
this->_udp = &udp;
|
this->_udp = &udp;
|
||||||
this->_timeOffset = timeOffset;
|
this->_timeOffset = timeOffset;
|
||||||
this->_poolServerName = poolServerName;
|
this->_poolServerName = poolServerName;
|
||||||
|
@ -15,7 +15,7 @@ class NTPClient {
|
|||||||
|
|
||||||
const char* _poolServerName = "pool.ntp.org"; // Default time server
|
const char* _poolServerName = "pool.ntp.org"; // Default time server
|
||||||
int _port = NTP_DEFAULT_LOCAL_PORT;
|
int _port = NTP_DEFAULT_LOCAL_PORT;
|
||||||
int _timeOffset = 0;
|
long _timeOffset = 0;
|
||||||
|
|
||||||
unsigned long _updateInterval = 60000; // In ms
|
unsigned long _updateInterval = 60000; // In ms
|
||||||
|
|
||||||
@ -28,10 +28,10 @@ class NTPClient {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
NTPClient(UDP& udp);
|
NTPClient(UDP& udp);
|
||||||
NTPClient(UDP& udp, int timeOffset);
|
NTPClient(UDP& udp, long timeOffset);
|
||||||
NTPClient(UDP& udp, const char* poolServerName);
|
NTPClient(UDP& udp, const char* poolServerName);
|
||||||
NTPClient(UDP& udp, const char* poolServerName, int timeOffset);
|
NTPClient(UDP& udp, const char* poolServerName, long timeOffset);
|
||||||
NTPClient(UDP& udp, const char* poolServerName, int timeOffset, unsigned long updateInterval);
|
NTPClient(UDP& udp, const char* poolServerName, long timeOffset, unsigned long updateInterval);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the underlying UDP client with the default local port
|
* Starts the underlying UDP client with the default local port
|
||||||
|
Loading…
Reference in New Issue
Block a user