Skip to content
rofl0r edited this page Nov 7, 2013 · 2 revisions

by installing the "timezones" package, a couple of timezone description files are installed into /share/zoneinfo. musl supports timezones via the POSIX TZ environment variable, so you should set that one in your ~/.profile or in /etc/profile. glibc also supports /etc/localtime (a copy or symlink of one of the zoneinfo files).

example values for the TZ env var:

  • TZ=Europe/Berlin musl will read the zoneinfo file /share/zoneinfo/Europe/Berlin whenever localtime() is called the first time by an app.
  • TZ=/etc/localtime musl will read the zoneinfo file /etc/localtime whenever localtime() is called the first time by an app. this file should be a copy or symlink to a some zoneinfo file as described in the above paragraph.
  • TZ=GMT-2 musl will set the timezone to GMT+2 (in POSIX, the meaning of the +/- is reversed)
  • TZ="CET-1CEST,M3.5.0,M10.5.0/3" should be equivalent to setting Europe/Berlin, except that no zoneinfo file needs to be read (this string is the last "line" from the zoneinfo file, which consists of 2 binary parts and this human readable string).

hwclock and ntp

on boot, (rc.boot), the system clock is set to the hardware clock using hwclock -u -s, where -u stands for UTC. the actual hardware clock can be read using hwclock -u -r. this will show the hardware clock, but adjusted to the users' TZ. so if you want to see the actual UTC clock value, use TZ=UTC hwclock -u -r.

if your hardware clock is off, you can fix it by using ntpd -dnq -p pool.ntp.org to get the actual time from ntp, and then write it to bios using hwclock -u -w.

links: