CFTimeZone: name and abbreviate GMT offsets like Apple - #138
Open
DTW-Thalion wants to merge 2 commits into
Open
Conversation
CFTimeZoneCreateWithTimeIntervalFromGMT gave every zone the same GMT+HH:MM string for both its name and its abbreviation. Apple names a zero offset GMT and others GMT with a four-digit offset (GMT+0500), but abbreviates them compactly (GMT, GMT+5, GMT+5:30). Build the padded name and the compact abbreviation separately. The existing basic test is updated.
DTW-Thalion
force-pushed
the
fix/cftimezone-gmt-abbrev
branch
from
July 24, 2026 15:45
2fa9bd4 to
9b3efe6
Compare
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.
CFTimeZoneCreateWithTimeIntervalFromGMT gave every zone the same GMT+HH:MM string as both its name and its abbreviation (GMT+00:00 for a zero offset). Apple treats the two separately:
Name: GMT for a zero offset, otherwise GMT with the signed four-digit offset and no colon (GMT+0500, GMT-0530).
Abbreviation: GMT for a zero offset, GMT with the hour for whole hours (GMT+5, GMT+10), and GMT with hour and minutes for the rest (GMT+5:30, GMT+0:30).
Build the padded name and the compact abbreviation separately. The existing Tests/CFTimeZone/basic.m asserted the old GMT+00:00 name and abbreviation and is updated to GMT.
Tests/CFTimeZone/gmt_name.m covers names and abbreviations across zero, whole-hour, half-hour and negative offsets. Verified against Apple CoreFoundation.
This supersedes #137, which fixed only the name format.