fixed DST - #45
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
include/croncpp.h:tm_isdst = -1is now set for every field before mktime, not just the date ones. Whatever field changes, the resulting time may fall on the other side of a transition, so the flag is never still known.detail::find_next_after, the single search entry point for bothcron_nextoverloads. It rejects any candidate that is not strictly later than the input and retries a second on, bounded byCRON_MAX_DST_SHIFT. This makes "the result is always in the future" an invariant rather than a special case, and it removes the duplicated "if the answer equals the input, add a second and search again" logic from both overloads.detail::field_value, plus a guard in the bitsetfind_next: if a field does not hold the value just written, that local time does not exist and the search moves on to the next larger field.README.md- a Time zones and daylight saving time section: croncpp works in local time, there is no UTC mode, TZ controls it, with a worked example of the spring gap and an explicit statement of what is and is not guaranteed at the autumn repeat.test/test_dst.cpp- pinsTZ=CST6CDTthrough an RAII helper. That name is understood both by the Windows CRT and by the zoneinfo database; the POSIX rule syntax used in the issue threads, such as CET-1CEST,M3.5.0,M10.5.0/3, is not portable to Windows. The first test case asserts the fixture really selected a zone with the expected transitions, so a platform that resolves the name differently fails with an obvious message instead of a confusing one.Testing
std::tmandstd::time_toverloads agree.Fixes #34
Fixes #24