Timezone in date?

2019-05-07 09:26发布

From where does the date command in Linux get the timezone information? I cannot see /etc/localtime file and /usr/share/zoneinfo direcory in my system. Still when i execute the date command i get the following output

Thu Dec 9 16:28:18 UTC 2010

Kindly tell me from where does the command get the timezone information?

Thanks, LinuxPenseur

3条回答
Melony?
2楼-- · 2019-05-07 09:43

Don't forget that UTC is how standard Unix systems store the date/time in the real time clock. You have to jump through hoops using funny programs (see the hwclock(8) manpage) if you dual-boot to Windows, which prefers the local time to be stored in the CMOS real time clock.

So the date(1) program is simply showing you the results of "I have no configured time zone":

# date -u
Thu Dec  9 10:40:54 UTC 2010
# TZ=UTC date
Thu Dec  9 10:40:57 UTC 2010
# TZ=PST8PDT date
Thu Dec  9 02:41:02 PST 2010
#
查看更多
一纸荒年 Trace。
3楼-- · 2019-05-07 09:47

From http://www.wikihow.com/Change-the-Timezone-in-Linux

On mobile phones and other small devices that run Linux, the time zone is stored differently. It is written in /etc/TZ, in the format that is described, for instance, in [4] . Edit this file manually or use echo (for instance, echo GMT0BST > /etc/TZ to set the the timezone of the United Kingdom).

From http://www.radisys.com/files/support_downloads/03245-02_MPCMM0001_MPCMM0002_CMM_Software_TPS.pdf

The CMM determines the offset to local timezone maintained in file /etc/cmm/TZ and automatically updates the time.

查看更多
登录 后发表回答