From: Paul Eggert <eggert@cs.ucla.edu>
To: Max Nikulin <manikulin@gmail.com>, libc-alpha@sourceware.org
Subject: Re: mktime result may depend on previous calls
Date: Wed, 18 Jan 2023 20:34:06 -0800 [thread overview]
Message-ID: <040c6e3a-e65d-972e-d644-f363c0536cc5@cs.ucla.edu> (raw)
In-Reply-To: <tqaboq$8u1$1@ciao.gmane.io>
On 1/18/23 19:00, Max Nikulin via Libc-alpha wrote:
> Paul, thank you for clarification. Should some note be added to the docs?
The actual behavior is reasonably complicated. As a time nerd I'm
probably the wrong person to ask about whether it should be documented.
>
> ---- >8 ----
> Notice that in the case of ambiguous local time (around a transition
> with backward step) multiple mktime calls with the same argument may
> return both values. Such kind of uncertainty appears if tm_isdst is set
> to -1 or if local time changes keeping the same DST state.
> ---- 8< ----
The above wording isn't quite right, as it ignores the role of tm_gmtoff
in mktime. (Did I say it was complicated? :-)
> It even might be used as a non-portable way of disambiguation: just add
> an extra call of mktime well aside from the backward time step. Too
> weird to use it in practice though. Unfortunately POSIX does not allow
> anything like
>
> https://www.python.org/dev/peps/pep-0495/
> PEP 495 – Local Time Disambiguation (Python)
POSIX does allow that sort of thing as an extension, and glibc mktime
does so: it disambiguates via tm_gmtoff.
next prev parent reply other threads:[~2023-01-19 4:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 15:39 Max Nikulin
2023-01-18 22:12 ` Paul Eggert
2023-01-19 3:00 ` Max Nikulin
2023-01-19 4:34 ` Paul Eggert [this message]
2023-01-19 7:10 ` Max Nikulin
2023-01-20 9:21 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=040c6e3a-e65d-972e-d644-f363c0536cc5@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=libc-alpha@sourceware.org \
--cc=manikulin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).