NTPClient icon indicating copy to clipboard operation
NTPClient copied to clipboard

Fix epoch time by removing user offset

Open petslane opened this issue 7 years ago • 3 comments

getEpochTime() should return epoch time that does not include offsets.

User offset is included in methods returning local times - getDay(), getHours(), getMinutes(), getSeconds(), getFormattedTime().

Fixes #35

petslane avatar Oct 31 '17 08:10 petslane

Can this be merged? the epoch time is wrong as it currently is

trapper- avatar Mar 12 '19 07:03 trapper-

Hi @petslane :wave: As much as I agree with your point, if we do in fact merge it then it would break compatibility with everyone who is relying on getEpochTime returning the unix epoch time + the set time offset. I'd propose a "softer" approach:

  1. Add 2 new methods which are in fact doing what their name advertises
unsigned long getUnixEpochTime() const; /* Returns the true unix epoch time without time offset */
unsigned long getUnixEpochTimeWithOffset() const { return getEpochTime(); }
  1. Mark getEpochTime as deprecated.
unsigned long getEpochTime() const __attribute__ ((deprecated));
  1. Release a new version and wait some time.
  2. Remove getEpochTime().

aentinger avatar Sep 19 '19 05:09 aentinger

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Peeter Normak seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 09 '21 13:04 CLAassistant