Change TZDEFRULES
and TZDEFRULESTRING
to "GMT"
.
#868
Closed
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.
This is a companion to changing the default
TZ
value from"GST"
to"GMT"
. The rationale is the same: it’s a less surprising "not defined" default.For the curious, details follow.
===
TZDEFRULES
is defined here and only used here, bylocaltime_tzparse()
.In the original IANA code, the value of
TZDEFRULES
is"posixrules"
."posixrules"
was a POSIX fallback mechanism that tried to derive rules for one timezone from another. Foolish mortals! It was declared obsolete in the 2019b IANA release. (For more info about what it tried to do, seeman 5 tzfile
.)If
TZDEFRULES
were set toNULL
,localtime_tzparse()
would fall back toTZDEFAULT
, because of this:cosmopolitan/libc/time/localtime.c
Lines 382 to 383 in e0c2b91
A recent pull request set
TZDEFAULT
to"GMT"
, so in a sense settingTZDEFRULES
toNULL
is another option. Setting it directly to"GMT"
, though, does a better job of making the intent obvious: if you can't find any rules, don't apply any rules.TZDEFULESTRING
is defined here and only used here, also inlocaltime_tzparse()
.The value I've used,
"GMT0"
, is the same valuegmtload()
passes tolocaltime_tzparse()
:cosmopolitan/libc/time/localtime.c
Lines 1372 to 1376 in e0c2b91
The format of the string is defined in Section 8.3 of the POSIX standard, available here.
I'm not sure I really wanted to know this much about how this stuff works. (How much do I really know…?) I'm not sure you really wanted to know this much about how this stuff works either. But here we are.
P.S. All of this is, in some sense, pointless; even
redbean-2.2.com
falls back to"GMT"
if a timezone isn't found:This change really only affects deeper, darker corners of the code. "You're in a maze of twisty little passages…"