[clue-tech] /proc times.

David Anselmi anselmi at anselmi.us
Mon Mar 14 17:50:52 MST 2005


Chris Schock wrote:
[...]
>>But I look at /proc and /proc/1 and they say 10:53.  /proc/2 (and many
>>others after that) say 17:54  which is what uptime says.  Anyone know
>>why the difference?
>>
>>Perhaps our TZ (-7) has something to do with it, though 10:53 isn't UTC
>>so it's 7 hours the wrong way.
> 
> 10:53 isn't UTC, but 17:54 is. My guess is that some things use localtime,
> and others always use UTC for a time stamp.

No.  The machine was booted at 17:54 local (that's MST, or tango -7 for 
you navy geeks) which is 00:54 (the next day) in UTC.

For Linux filesystems the file timestamps are always kept in UTC 
(actually epoch seconds) and that gets converted to local time for display.

[...]
> 2. Something in /proc got added right away in UTC, then ntpdate or ntpd
> kicked in later in the boot process and adjusted the clock back a few
> seconds while other things in /proc were added.

I'll go with this one and answer my own question.  When the kernel boots 
it loads the time from the RTC and stamps /proc, assuming that the RTC 
is UTC (it isn't on this box).  Then it figures out the timezone and 
resets itself.

Interestingly, the ps stime for init is correct.

Dave



More information about the clue-tech mailing list