heliclockter icon indicating copy to clipboard operation
heliclockter copied to clipboard

System (or "local") time zone implementation for `tz_local` that can handle DST and time zone transitions and is based on the `time` module

Open blubberdiblub opened this issue 2 years ago • 2 comments

This addresses one of Arie Bovenberg's complaints in #12 regarding the tz_local attribute of heliclockter. It provides an own implementation that doesn't need the tzlocal module (but can optionally utilize it to return a more useful value from the .key attribute if it happens to be installed) and is properly sensitive to TZ and time.tzset().

Note that this pull request depends on the fold attribute added in #13 which hasn't been merged yet (and as such is built on top of the commits from the add-fold branch). So please don't consider merging this before the other pull request has been merged and this one properly rebased against the resulting master.

It's also fine to reject the pull request, if you don't want or need this in heliclockter.

Note that this also brings along a test suite with extensive checks against dates and times, many of which are possible edge cases. The test scaffolding could also be utilized for other existing tests. E.g. in instantiation_test.py it says "We cannot test datetime_local as the expected hour will vary on the system testing", which used to be true, but with the tzset, systemtz and welldefined_timezone fixtures it's now possible to test it as well. For that, it'd likely be desirable to move the fixtures to a more central place, such as conftest.py, which would make them available to all tests.

blubberdiblub avatar Jan 23 '24 16:01 blubberdiblub

@blubberdiblub, thanks for your contribution! Do you mind rebasing this PR, then I will try to have a look at it

p-nilsson avatar Feb 13 '24 06:02 p-nilsson

Sorry, me removing the add-fold branch automatically closed this branch. @blubberdiblub could you rebase and point this to master so we can remove the add-fold branch without closing your PR? :)

DanielNoord avatar Mar 26 '24 12:03 DanielNoord