[tz] OpenJDK/CLDR/ICU/Joda issues with Ireland change

Paul Eggert eggert at cs.ucla.edu
Sat Jan 27 18:13:15 UTC 2018

J William Piggott wrote:
> why not get the offset directly from TZ/tzfile the
> same way tzset does for tm_gmtoff

Let me try to be clear about the question since I evidently didn't understand 
your previous email. When you write "get the offset directly from TZ/tzfile", I 
assume you don't mean that users are expected to write complex code that behaves 
like tzcode's localtime.c and that goes off and parses the TZ environment 
variable and/or reads files in tzfile format and get the offset directly from 
that string or data. Instead, I assume you are asking for an API that lets users 
easily determine the UTC offset of a timestamp.

For tzcode, GNU/Linux, FreeBSD, etc., that API is already there: it's the 
tm_gmtoff member of struct tm. For POSIX there is no such API, so one must play 
the diff(LOCALTIME,GMTIME) trick.

One could design a different API to do what tm_gmtoff does, an API that uses a 
function rather than a structure member, and implement this function by doing 
what tzset does and a little bit more. However, as far as I know, nobody has 
done that for C in any widely-used distribution, and there's been no need to do 
it because tm_gmtoff already handles the problems that the function would address.

More information about the tz mailing list