Skip to content

AU (GMT+10)+ : Any offset over 32767 did not work - fix included #72

Open
@ghost

Description

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions