From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>
Cc: bug-gnulib@gnu.org
Subject: Re: localtime on native Windows
Date: Sun, 18 Feb 2024 11:05:52 -0800 [thread overview]
Message-ID: <ffd7d3bb-ad22-426a-b948-8abee8ea0786@cs.ucla.edu> (raw)
In-Reply-To: <5188612.NACDBdzCOe@nimes>
On 2024-02-18 06:38, Bruno Haible wrote:
> - How can the caller do the caching for something internal to the callee?
The caller calls tzalloc, gets a timezone object, and calls tzfree when
it no longer needs that timezone object.
> - The NetBSD code [1][2] does locking in the top-level functions (tzset,
> mktime, strftime). I guess that it is because NetBSD uses global variables
> (tzname, timezone, daylight, altzone).
This is for backward compatibility, and is required for POSIX
compatibility. It has obvious problems with threads. New code should not
use these vestigial interfaces. They should use localtime_z and
mktime_z. (There should be no need for strftime_z.)
https://data.iana.org/time-zones/theory.html#vestigial
> For Gnulib, I intend to avoid global variables of this kind — they belong
> in data allocated for each time zone — and therefore move the locking to
> lower levels. In the frequent case that a timezone is used for the second
> time or later, no locking will be needed at all; this will thus be faster
> than what NetBSD does.
You're right to avoid the global variables, but I don't see why tzalloc
needs to lock, even in MS-Windows. Perhaps there could be an "I'll do
the caching" layer above tzalloc, but the lower-level code need not lock
at all.
next prev parent reply other threads:[~2024-02-18 19:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 17:43 MT-unsafe time modules Bruno Haible
2024-02-09 20:22 ` Bruno Haible
2024-02-10 11:10 ` Bruno Haible
2024-02-11 12:46 ` localtime on native Windows Bruno Haible
2024-02-13 2:02 ` Paul Eggert
2024-02-18 2:38 ` Bruno Haible
2024-02-18 4:50 ` Paul Eggert
2024-02-18 14:38 ` Bruno Haible
2024-02-18 19:05 ` Paul Eggert [this message]
2024-02-11 10:43 ` MT-unsafe time modules Bruno Haible
-- strict thread matches above, loose matches on Subject: below --
2024-02-13 18:25 localtime on native Windows Brian Inglis
2024-02-18 2:14 ` Bruno Haible
2024-02-18 5:32 ` Brian.Inglis
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ffd7d3bb-ad22-426a-b948-8abee8ea0786@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/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).