[tz] [libc-coord] thread-safe localtime() for an arbitrary timezone
Paul Eggert
eggert at cs.ucla.edu
Wed Jun 21 21:18:26 UTC 2023
On 2023-06-21 12:50, enh wrote:
> my preference would be for timezone_t to be more like DIR...
>
> typedef struct DIR DIR;
Although that would also work, that's not how NetBSD did things when it
introduced timezone_t in NetBSD 6.0 (2012), and tzcode copied this part
of NetBSD in tzdb 2014g. I doubt whether we should change the meaning of
timezone_t at this point, as it'd be too much backward-compatibility hassle.
We could use a different name, though, for the struct. How about if we
change this line in tzcode private.h:
typedef struct state *timezone_t;
to the following?
typedef struct tm_timezone *timezone_t;
and change all other instances of "struct state" to "struct tm_timezone"?
This would let users write "struct tm_timezone *" and "timezone_t"
interchangeably. The name tm_timezone, like timezone_t, is reserved by
POSIX when you include <time.h>[1], so if the <time.h> implementation
uses this name it won't break any conforming programs.
[1]:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_02
More information about the tz
mailing list