Skip to main content
Topic: Time zone data not correct (Read 1333 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Time zone data not correct

It seems the time zone data is corrupted for some timezones:

Code: [Select]
# This date is correct
$ date
Wed Apr 9 14:14:19 CEST 2025

# This date is also correct
$ TZ=UTC date
Wed Apr  9 12:17:20 UTC 2025

# !!! THIS DATE IS WRONG !!!
# it should be +1200 but it is +0000
$ TZ=NZST date
Wed Apr  9 12:18:48 NZST 2025

I'm using ntpd to sync my time with timeservers. Maybe it corrupts the zonedata? Reinstalling tzdata did not help.
How can I fix this?

Any help would be much appreciated.

EDIT: I switched to chrony and reinstalled tzdata. Same results.

Another  EDIT: I tested on Alpine, Debian, Raspberry Pi OS and FreeBSD also, they all seem to have this problem. So I guess it's not Artix specific and the "tzdata" package is simply wrong.

Re: Time zone data not correct

Reply #1
Try TZ=NZ


Re: Time zone data not correct

Reply #3
Code: [Select]
$ zdump /usr/share/zoneinfo/Pacific/Auckland                                                                                                             [10:20:36]
/usr/share/zoneinfo/Pacific/Auckland  Sat Apr 12 21:22:05 2025 NZST


$ zdump -v /usr/share/zoneinfo/Pacific/Auckland |grep 2025                                                                                               [10:14:29]
/usr/share/zoneinfo/Pacific/Auckland  Sat Apr  5 13:59:59 2025 UT = Sun Apr  6 02:59:59 2025 NZDT isdst=1 gmtoff=46800
/usr/share/zoneinfo/Pacific/Auckland  Sat Apr  5 14:00:00 2025 UT = Sun Apr  6 02:00:00 2025 NZST isdst=0 gmtoff=43200
/usr/share/zoneinfo/Pacific/Auckland  Sat Sep 27 13:59:59 2025 UT = Sun Sep 28 01:59:59 2025 NZST isdst=0 gmtoff=43200
/usr/share/zoneinfo/Pacific/Auckland  Sat Sep 27 14:00:00 2025 UT = Sun Sep 28 03:00:00 2025 NZDT isdst=1 gmtoff=46800
That all looks correct.
Code: [Select]
$ date                                                                                                                                       [10:53:15]
Sat Apr 12 10:53:20 BST 2025

$ sudo ln -sf /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
$ date                                                                                                                                       [21:55:04]
Sat Apr 12 21:55:21 NZST 2025

As does that.

No idea what is going on but New Zealand time works for me.
For extra authenticity I was upside down while testing this :P

Edit: Actually the environment variable is not being used properly
Code: [Select]
TZ=NZST date                                                                                                                               [11:02:00]
Sat Apr 12 10:04:59 NZST 2025

Just link the zoneinfo file to /etc/localtime as above and it will work. (caveat, see below).
I didn't know the environment variable was even a thing?

Edit2: This works with the environment variable:
Code: [Select]
TZ=:Pacific/Auckland date                                                                                                                  [11:21:25]
Sat Apr 12 22:21:32 NZST 2025

Edit to end all edits
Been down the rabbit hole with this.
If TZ is invalid, as in NZST, glibc will not then check /etc/localtime, it will use the invalid value and hence default to UTC.
So make sure TZ is unset if using the link. Or at least right.
glibc checks for the environment variable, if there isn't one it reads /etc/localtime.
At least I think so  :)