Skip to content

Support for Timezones expressed in seconds #2543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stelgenhof opened this issue Sep 22, 2016 · 4 comments
Closed

Support for Timezones expressed in seconds #2543

stelgenhof opened this issue Sep 22, 2016 · 4 comments
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@stelgenhof
Copy link

Currently the sntp_set_timezone function accepts an integer with limits set between -11 and 13 (UTC hour offsets). This limits the use for timezones that have not an offset of an exact hour. See for example UTC−09:30.

There are a few more such timezones (See: https://en.wikipedia.org/wiki/Time_zone#List_of_UTC_offsets)

Additionally there is also a UTC offset UTC−12:00 and UTC+14:00.

It would be good if the code could be updated to reflect the correct UTC offsets. In that regards it might be better to express the function argument in seconds (rather than hours). This would support for timezones like UTC-09:30.

@PRO2XY
Copy link

PRO2XY commented May 9, 2017

As of the present core, the timezone is expressed in seconds in the call to configTime(....). However after being passed to the underlying function in time.c it is divided by 3600, when calling the sntp function sntp_set_timezone(sint8 timezone), where it gets rounded back to a whole number.

I tried to change the datatype on the relevant functions in sntp.c/.h and time.c/.h hoping that it might be a simple fix for timezones that are not a full hour difference, but it didn't seem to work.
Also (somewhat related) changing daylightOffset_sec doesn't seem to be a workaround when trying to add that half an hour either.

@devyte
Copy link
Collaborator

devyte commented Oct 12, 2017

@stelgenhof @PRO2XY have you tried TimeLib, and NtpClientLib? They may be easier to modify.

@devyte devyte added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label Oct 12, 2017
@stelgenhof
Copy link
Author

@devyte Could you perhaps send a link for these two libraries you are referring to? There are many with the same name :).

NTPClientLib has timezone support but with a similar limitation (time difference is an uint8_t) and TimeLib has no timezone support (This is if these are the ones you are referring to).

That's why I created my own NTPClient with full timezone support: https://github.com/stelgenhof/NTPClient. It only lacks DST support at this moment.

Nonetheless, I would be nice if it could be corrected in this SDK.

@devyte
Copy link
Collaborator

devyte commented Feb 27, 2019

Closing as duplicate of #5823 .

@devyte devyte closed this as completed Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests

3 participants