Skip to content

Conversation

wishdev
Copy link

@wishdev wishdev commented Jun 4, 2025

This addresses an issue with the crossing of daylight savings time boundaries.

Specifically the test on line 912 skips the entire day of 3/10/2019 without the fix.

As I believe I understand the issue is as follows (for the test on line 912)

The code creates a struct tm on 3/9 and then as it works to locate the next time (which should be 3/10 at 6AM) - it sets the struct to 23:00 on 3/10 (to change days) but it has the isdst flag as 0.
Then the system (i.e. not this library) reads that time and readjusts the struct to 0 hours on 3/11 with the isdst flag as 1.
The code then zeros out the hours and tries to start looking for the next match. But it's jumped over the 10th due to the daylight savings jump, obviously not the desired situation.

Switching the isdst flag to -1 when we set a field allows the system to properly switch into the 10th and therefore the struct gets to the correct spot and works properly.

@exander77
Copy link
Owner

Thank you for pull, it looks reasonable as to fix, I am not sure if it doesn't influences anything else, can you explain those two test changes?

@wishdev
Copy link
Author

wishdev commented Jun 23, 2025

My apologies - both of those tests failed originally for me as they crossed DST changes in North America. I had "commented" them out by switching the dates. That should have been changed back prior to the original push - corrected.

@exander77
Copy link
Owner

I think this breaks something else, I need to look into it deeper. Main issue is that underlying time implementation from libc is not good in general (both glibc and musl). So it is really hard to build on top of it.

@wishdev
Copy link
Author

wishdev commented Jul 11, 2025

I'm certainly not an expert so I can appreciate the caution here. The beauty is that I can move right along in my little world with my patch and be very happy - open source at its finest!

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

Successfully merging this pull request may close these issues.

2 participants