#3890: mutt_mktime is ambiguous near DST change
---------------------+----------------------
Reporter: vinc17 | Owner: mutt-dev
Type: defect | Status: new
Priority: major | Milestone:
Component: mutt | Version: 1.7.1
Resolution: | Keywords:
---------------------+----------------------
Comment (by vinc17):
Replying to [comment:2 derekmartin]:
> This seems to be the right idea. But Mutt should not assume TZ is set:
These days I think TZ is typically unset, and the system libraries rely on
settings from /etc/localtime, at least on Linux.
I agree. But I suppose that by saying "set 'TZ' back", the manual
implicitly means to restore the TZ status (i.e. unset it if it was unset,
else set it to the old value).
> So Mutt will probably need to do something like:
>
> {{{
> char *tz = getenv("TZ");
> setenv("TZ", "GMT", 1);
> /* do time conversion stuff */
> ...
> if (tz) setenv("TZ", tz, 1);
> else unsetenv("TZ");
> ...
> }}}
Instead of "GMT", shouldn't "GMT0" (for compatibility with old systems) or
"UTC0" be used?
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html says
for the {{{date -u}}}:
Perform operations as if the TZ environment variable was set to the
string "UTC0", or its equivalent historical value of "GMT0". Otherwise,
date shall use the timezone indicated by the TZ environment variable or
the system default if that variable is unset or null.
and in the rationale:
Some of the new options for formatting are from the ISO C standard. The
-u option was introduced to allow portable access to Coordinated Universal
Time (UTC). The string "GMT0" is allowed as an equivalent TZ value to be
compatible with all of the systems using the BSD implementation, where
this option originated.
--
Ticket URL: <https://dev.mutt.org/trac/ticket/3890#comment:3>
Mutt <http://www.mutt.org/>
The Mutt mail user agent