[lug] laptop time

rm at mamma.varadinet.de rm at mamma.varadinet.de
Fri Feb 23 10:56:08 MST 2001


On Fri, Feb 23, 2001 at 10:25:35AM -0700, Timothy C. Klein wrote:
> 
> On Fri, Feb 23, 2001 at 10:40:36AM -0500, John Karns wrote:
> > What about the timestamps on the filesystem.  What I would't like is
> > having to deal with GMT in the file timestamps.  I presume that cron would
> > be referenced to the local time and not GMT - correct?
> 
> I believe time stamps are stored in GMT.  However, this is actually the
> best way, if everyone uses GMT.  

AFAIK they are stored in seconds since epoch, i.e. seconds since
1.1.1970 (this is when everything began :-)
BTW, GMT is definitely not what you would want to use, use UTC.
UTC is a kind of abstract global time reference used on most
(*nix) hosts. GTM is the timezone for certain parts of europe etc.
There _is_ a big difference: GMT does have daylight savings time,
so sometimes GMT !+ UTC.

> Every call to the kernel to give a user
> the value of a time variable involves applying the local offset to that
> time, so your files can all be time-stamped in GMT and you would never
> know it.  The only way it could be a problem that I see is if you
> regularly schlep files between machines that are set differently, ie one
> hardware clock set to GMT, and the other not.  But even this could be
> worked around, I suppose, it kinda kludgey.

Actually, time is commonly expressed as a type time_t in libc/syscalls.
This is defined (via several typedefs in /usr/include/bits/time.h as
'typedef long int __time_t;' Hmmm, what does this imply? At some point
seconds-since-epoch will be greater than the greatest long int (32bit).
So sometime during 2038 time will warp back to the seventies. Get out
your bell-bottoms ;-) 

 Ralf 


> The cool thing about storing them as GMT, though, is that the file you
> create at 10:19 23 Feb 2001, will show that as the creation time to you,
> but if you send that file, and preserve its setting, it will show your
> friend in England that the file was created at 17:19 23 Feb 2001, and
> your friend in Tokyo will see the file as created at 02:19 24 Feb 2001.
> That is very nice, in this way *ALL* Linux kernels keep track of things
> in one time frame.  It gets converted to local time for our benefit.
> Very slick.  All machines should be REQUIRED to work this way.  Then
> things like time stamps on mail and the like would always work
> 
> Also, your machine only looks at the hardware clock at bootup time, and
> after a suspend  on a laptop (or a desktop).  From that point on the
> kernel keeps its own clock.
> 
> Tim
> 
> > ----------------------------------------------------------------------
> > John Karns                                              jkarns at csd.net
> > 
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> 
> -- 
> ===================================================================
> == Timothy Klein       || And what rough beast                   ==
> == teece at hypermall.net || Its hour come round at last            ==
> == Aufwiedersehen!     || Slouches towards Bethlehem to be born? ==
> == Aufwiedersehen!     || The beast of Redmond, nothing more.    ==
> ===================================================================
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list