Skip to content

Commit

Permalink
Make mUpdateInterval uint32_t for better compatibity with differnet
Browse files Browse the repository at this point in the history
hardware.

AS decribed in aharshac#5

On some boards (e.g. ATmega like Uno) "int" is only 2 bytes and thus is capped unsigned at only roughly 65000. As mUpdateInterval holds milliseconds this more or less means that you can have 1 minute max as update interval.
  • Loading branch information
electricant committed Apr 2, 2021
1 parent fc4f7a1 commit 6eaabe4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/EasyNTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class EasyNTPClient
int getTimeOffset();
void setTimeOffset(int offset);
unsigned long getUnixTime();

private:
UDP *mUdp;
const char* mServerPool = "pool.ntp.org";
int mOffset = 0;
unsigned int mUpdateInterval = 60000;
uint32_t mUpdateInterval = 60000;
unsigned long mLastUpdate = 0;
long mServerTime = 0;
unsigned long getServerTime();
};

#endif
#endif

0 comments on commit 6eaabe4

Please sign in to comment.