Skip to content
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

wrong day for DST change #11

Closed
dobryj opened this issue Oct 27, 2018 · 7 comments
Closed

wrong day for DST change #11

dobryj opened this issue Oct 27, 2018 · 7 comments

Comments

@dobryj
Copy link

dobryj commented Oct 27, 2018

Hi!

today I detect, that time from ezTime library is invalid. After some investigation I found, that problem is that ezTime thing that I need CET time, but today is last day with CEST
I am set Olsen format "Europe/Prague"
It is converted to POSIX correctly : "CET-1CEST,M3.5.0,M10.5.0/3"
This is correct. Problem is that today (27-Oct-2018) is last weekend on October but not .0 ( =Sunday)
ezTime show Time: Saturday, 27-Oct-2018 12:08:32 CET

Any idea?

@ropg
Copy link
Owner

ropg commented Oct 27, 2018

Ouch, see the same problem here. Looks like something is off. I will look into that urgently later today or tomorrow...

@chinswain
Copy link
Contributor

Same for gb timezone:

UTC: Saturday, 27-Oct-2018 12:00:38 UTC
New Zealand: Sunday, 28-Oct-2018 01:00:38 NZDT
United Kingdom: Saturday, 27-Oct-2018 12:00:38 GMT
Local (GeoIP): Saturday, 27-Oct-2018 12:00:38 GMT

@dobryj
Copy link
Author

dobryj commented Oct 27, 2018

I found reason.
Problem is on dst_start and dst_end equations.
Hotfix is +1 on "dow" in library (line 741+742) like

time_t dst_start = ezt::makeOrdinalTime(start_time_hr, start_time_min, 0, start_week, start_dow+1, start_month, tm.Year + 1970);
time_t dst_end = ezt::makeOrdinalTime(end_time_hr, end_time_min, 0, end_week, end_dow+1, end_month, tm.Year + 1970);

In detal it is problem on weekday numbering. In ezTime function UTC.weekday() return sunday=1. But posix rule use sunday=0.

@ropg
Copy link
Owner

ropg commented Oct 29, 2018

I found reason.
Problem is on dst_start and dst_end equations.
Hotfix is +1 on "dow" in library (line 741+742) like

time_t dst_start = ezt::makeOrdinalTime(start_time_hr, start_time_min, 0, start_week, start_dow+1, start_month, tm.Year + 1970);
time_t dst_end = ezt::makeOrdinalTime(end_time_hr, end_time_min, 0, end_week, end_dow+1, end_month, tm.Year + 1970);

In detal it is problem on weekday numbering. In ezTime function UTC.weekday() return sunday=1. But posix rule use sunday=0.

You're absolutely right: a bug indeed, and the fix is exactly as you describe. I will release a new version of ezTime later today.

@JasXSL
Copy link

JasXSL commented Mar 27, 2019

I'm getting a DST issue here too. Using tz.setLocation(F("Europe/Stockholm")) it's giving me CEST a week in advance. Maybe because this year there are 5 Sundays in March?

@ropg
Copy link
Owner

ropg commented Mar 27, 2019 via email

@JasXSL
Copy link

JasXSL commented Mar 27, 2019

Yep that update fixed it, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants