Re: Setting time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 5 Sep 2003, Jesse Keating wrote:

>So a file that was created with a timezone setting of EST, then the user
>sets the timezone to PST, wouldn't the file have a timestamp 3 hours in
>the future, or would the timestamp change to reflect the timezone?

It would be displayed as PST/PDT.

>Is the TRUE timestamp something different, and what ls et al show us is
>the REAL timestamp filtered through a timezone adjustment?

For "proper" UNIX filesystems, I believe the date is stored as UTC, but
presented in the localtime timezone *at the timestamp of the file*.

For example:

$ export TZ=Europe/London
$ date
Fri Sep  5 19:38:14 BST 2003
$ touch file1
$ date -s '12 Nov 2003 12:00:00'
Wed Nov 12 12:00:00 GMT 2003
[Note timezone change due to daylight savings]
$ touch file2
$ ls -l
-rw-r--r--	1 root	root		0 Sep  5 19:38 file1
-rw-r--r--	1 root	root		0 Nov 12 12:00 file2
$ env TZ=GMT ls -l
-rw-r--r--	1 root	root		0 Sep  5 18:38 file1
-rw-r--r--	1 root	root		0 Nov 12 12:00 file2

Notice how the first "ls -l" has given file1's time in BST, even though
the "current" timezone is GMT.

If the TZ environment variable is not set, libc looks at /etc/localtime
to determine the timezone.


Hope this helps,
Phil




[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux