Re: UCT (Re: pgsql: Update time zone data files to tzdata release2019a.) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: UCT (Re: pgsql: Update time zone data files to tzdata release2019a.)
Date
Msg-id 20190604164338.wimx6qlp4wyc7r46@alap3.anarazel.de
Whole thread Raw
In response to Re: UCT (Re: pgsql: Update time zone data files to tzdata release2019a.)  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 2019-06-04 08:53:30 -0700, Andres Freund wrote:
> If I set the system-wide default, using dpkg-reconfigure -plow tzdata,
> to UTC I *do* get Etc/UTC.
> 
> root@alap4:/home/andres/src/postgresql# cat /etc/timezone
> Etc/UTC
> root@alap4:/home/andres/src/postgresql# ls -l /etc/timezone
> -rw-r--r-- 1 root root 8 Jun  4 15:44 /etc/timezone
> 
> selecting default timezone ... Etc/UTC
> 
> This is independent of being built with system or non-system tzdata.
>
> Enabling debugging shows:

Sorry, I was not awake enough while reading the thread (and UCT looks so
similar to UTC).

I do indeed see the behaviour of choosing UCT in 11, but not in
12. Independent of system/non-system tzdata. With system tzdata, I get
the following debug output (after filtering lots of lines wiht out |grep
-v 'scores 0'|grep -v 'uses leap seconds')

TZ "Zulu" gets max score 5200
TZ "UCT" gets max score 5200
TZ "Universal" gets max score 5200
TZ "UTC" gets max score 5200
TZ "Etc/Zulu" gets max score 5200
TZ "Etc/UCT" gets max score 5200
TZ "Etc/Universal" gets max score 5200
TZ "Etc/UTC" gets max score 5200
TZ "localtime" gets max score 5200
TZ "posix/Zulu" gets max score 5200
TZ "posix/UCT" gets max score 5200
TZ "posix/Universal" gets max score 5200
TZ "posix/UTC" gets max score 5200
TZ "posix/Etc/Zulu" gets max score 5200
TZ "posix/Etc/UCT" gets max score 5200
TZ "posix/Etc/Universal" gets max score 5200
TZ "posix/Etc/UTC" gets max score 5200
ok

whereas master only does:

selecting default timezone ... symbolic link "/etc/localtime" contains "/usr/share/zoneinfo/Etc/UTC"
TZ "Etc/UTC" gets max score 5200
Etc/UTC

The reason for the behaviour difference between v12 and 11 is that 12
does:

    /*
     * Try to avoid the brute-force search by seeing if we can recognize the
     * system's timezone setting directly.
     *
     * Currently we just check /etc/localtime; there are other conventions for
     * this, but that seems to be the only one used on enough platforms to be
     * worth troubling over.
     */
    if (check_system_link_file("/etc/localtime", &tt, resultbuf))
        return resultbuf;

which prevents having to iterate through all of these files, and ending
up with a lot of equivalently scored timezones.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: UCT (Re: pgsql: Update time zone data files to tzdata release 2019a.)
Next
From: Andres Freund
Date:
Subject: Re: UCT (Re: pgsql: Update time zone data files to tzdata release2019a.)