Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timezone in date?

From where does the date command in Linux get the timezone information? I cannot see /etc/localtime file and /usr/share/zoneinfo directory 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

like image 863
nitin_cherian Avatar asked Oct 13 '22 19:10

nitin_cherian


2 Answers

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
#
like image 65
sarnold Avatar answered Oct 18 '22 01:10

sarnold


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.

like image 33
Thomas Avatar answered Oct 18 '22 02:10

Thomas