AU (GMT+10)+ : Any offset over 32767 did not work - fix included #72
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Time offset for Australia GMT +10 is 36,000 (plus 10 hours), however the datatype for offset in my library was int. The current code it is a long, and a long has a maximum value of 32,767. If you need a higher offset, ie, in Australia +10, etc, you need to modify the datatype to unsigned long, in the following locations:
NTPClient.h
line 18:
unsigned long _timeOffset = 0;
lines 31-44:
NTPClient(UDP& udp, unsigned long timeOffset); NTPClient(UDP& udp, const char* poolServerName); NTPClient(UDP& udp, const char* poolServerName, unsigned long timeOffset); NTPClient(UDP& udp, const char* poolServerName, unsigned long timeOffset, int updateInterval);
line 69:
void setTimeOffset(unsigned long timeOffset);
NTPClient.cpp
line 28:
NTPClient::NTPClient(UDP& udp, unsigned long timeOffset) {
line 38:
NTPClient::NTPClient(UDP& udp, const char* poolServerName, unsigned long timeOffset) {
line 44:
NTPClient::NTPClient(UDP& udp, const char* poolServerName, unsigned long timeOffset, int updateInterval) {
line 143:
void NTPClient::setTimeOffset(unsigned long timeOffset) {
Just incase you're from Australia and scratching your head like I'd been doing for an hour or so. Enjoy :)
The text was updated successfully, but these errors were encountered: