Skip to content

Rewrite timezone handling to support tzinfo zones, not fixed offsets #2

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

teliseo
Copy link

@teliseo teliseo commented Jan 31, 2025

  • In addition to fixed offsets, tzinfo timezone names may now be used in the --tz and --move-zone options, and in the AuthorMap file.
  • --tz now doesn’t just affect the log display, it changes the interpretation of the local timestamps in SCCS deltas. Without --tz, deltas are treated as in the system default timezone, or as specified by the TZ environment variable. In all cases, there is proper handling of daylight/summer time, which was previously lacking.
  • --move-zone has changed from --move-offset. It is now a new timezone name or offset, not an hour offset from the previous zone.
  • The AuthorMap parser is now much more robust, and can accept all forms of time zone specs.
  • A timezone specified in the AuthorMap now takes precedence over --move-zone.
  • Previously, specifying an AuthorMap file prevented fallback to system login name lookup, which it now does.
  • Optimizations have been made to delta sorting.

This improved timezone handling doesn’t require any third-party modules, but ZoneInfo does require a fairly recent version of Python, 3.9, released in 2020. Everything should be golden on modern Posix-compatible systems, but Windows and some containers may lack a proper tzinfo backend, requiring additional modules.

For Windows specifically, depending on the local zone fallback will not properly handle daylight/summer time, but this can be mitigated by always specifying a tzinfo zone name with the --tz option. This could be improved by using the third-party tzlocal module, but I didn’t do this to avoid a third-party dependency.

- In addition to fixed offsets, tzinfo timezone names may now be used in
  the --tz and --move-zone options, and in the AuthorMap file.
- --tz now doesn't just affect the log display, it changes the
  interpretation of the local timestamps in SCCS deltas. Without --tz,
  deltas are treated as in the system default timezone, or as specified
  by the TZ environment variable. In all cases, there is proper
  handling of daylight/summer time, which was previously lacking.
- --move-zone has changed from --move-offset. It is now a new timezone
  name or offset, not an hour offset from the previous zone.
- The AuthorMap parser is now much more robust, and can accept all forms
  of time zone specs.
- A timezone specified in the AuthorMap now takes precedence over --move-zone.
- Previously, specifying an AuthorMap file prevented fallback to system login
  name lookup, which it now does.
@robohack
Copy link
Owner

This looks very interesting too.

I'll try it with my test case repository soon!

@teliseo
Copy link
Author

teliseo commented Feb 2, 2025

I intend for you to merge my other PR (#1) first, which will cause a couple of merge conflicts with this one (around the option parsing). I’m not sure if I have the appropriate perms to fix them, or if you have to do this. I could always merge your updated master into this branch locally and then push, but I don't know if that's the cleanest github strategy.

After this, I think I’m done with major hacking on this project for a while, as it now meets my needs.

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