LWN.net Logo

Filesystem timestamps

Filesystem timestamps

Posted Oct 20, 2011 12:14 UTC (Thu) by xav (guest, #18536)
Parent article: Time zone database attacked but finds a new home

I didn't realize fs timestamps were in localtime. I always thought they were UTC (and I hacked ext2fs tools back in the days).


(Log in to post comments)

Filesystem timestamps

Posted Oct 20, 2011 12:57 UTC (Thu) by garloff (subscriber, #319) [Link]

FS timestamps are stored in UTC on Un*x filesystems (which is IMVHO the only sane thing to do as well). But they are displayed in localtime, so the user can understand it ...

Filesystem timestamps

Posted Oct 20, 2011 15:50 UTC (Thu) by anselm (subscriber, #2796) [Link]

Actually file timestamps are stored neither in UTC nor in local time, but in the famous »number of seconds elapsed since 1 January 1970, 0:00 UTC« format. These are then converted to whatever timezone one has set up when they are being displayed.

Filesystem timestamps

Posted Oct 20, 2011 18:15 UTC (Thu) by magila (subscriber, #49627) [Link]

If you want to be really pedantic the one sane way to store timestamps would be using TAI. Using a discontinuous time standard (UTC) as the system time has been, and will continue to be, a major source of ugliness.

Filesystem timestamps

Posted Oct 21, 2011 0:13 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

If you want to be really pedantic the one sane way to store timestamps would be using TAI. Using a discontinuous time standard (UTC) as the system time has been, and will continue to be, a major source of ugliness.
A continuous time standard (TAI) would be ugly in other ways, and I believe on balance more ugly.

If we could get people to stop living their lives by sunrise and sunset and abandon the discontinuous time scale they use in all other aspects of their lives, then TAI would be a good clean fit for timekeeping in computers.

Incidentally, Unix doesn't use UTC except to specify the epoch.

(For those who don't know what we're talking about: UTC expresses time in year, month, day, etc. and every so often, with no pattern, a minute has 61 seconds so that all years start with the earth oriented the same way toward the sun. TAI is a simple ever-increasing seconds value, so there's no sun alignment issue and no place to insert leap-anything.

The Unix time standard is like TAI in that it's just a seconds value, but like UTC in that it just stops incrementing for a second every time a UTC minute has a 61st second. The point of that is to make it easier to convert to UTC, and do time arithmetic.)

Filesystem timestamps

Posted Oct 21, 2011 2:39 UTC (Fri) by njs (guest, #40338) [Link]

Or maybe UTC will become TAI... [1]

Though the argument I find most compelling is that everyone should switch to TAI for internal timekeeping, and then make UTC a new timezone (with a very small offset) -- the way leap seconds get added is almost exactly like the way that political entities are always rearranging DST rules, and can use the same mechanism.[2]

[1] http://www.ucolick.org/~sla/leapsecs/onlinebib.html
[2] http://www.ucolick.org/~sla/leapsecs/right+gps.html

Filesystem timestamps

Posted Oct 20, 2011 13:53 UTC (Thu) by cladisch (✭ supporter ✭, #50193) [Link]

FAT stores timestamps in localtime. Microsoft changed this in NTFS, but given the pervasiveness of FAT32 even today, it's a good idea to display those timestamps correctly (or at least in the same way as Windows).

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds