dushaoshuai / dushaoshuai.github.io

https://www.shuai.host
0 stars 0 forks source link

time zones #41

Open dushaoshuai opened 1 year ago

dushaoshuai commented 1 year ago

IANA Time Zone database Wikipedia - Time zone Wikipedia - Lists of time zones go package - time.Location Get Current System Time Zone in Linux go package - tzdata

localtime

/etc/localtime configures the system-wide timezone. It's a symlink pointing to the actual binary timezone data file in /usr/share/zoneinfo/.

$ ls -l /etc/localtime 
lrwxrwxrwx 1 root root 33 Nov 17 06:18 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai

See man 5 localtime for more information.

/etc/timezone stores the timezone of the system in plain text format.

$ cat /etc/timezone 
Asia/Shanghai

timedatectl show timezone of the system.

$ timedatectl 
               Local time: Mon 2022-11-21 14:51:29 CST
           Universal time: Mon 2022-11-21 06:51:29 UTC
                 RTC time: Mon 2022-11-21 06:51:29
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

See man timedatectl for more information.