On Thu, Nov 7, 2019 at 7:31 AM R.Wieser <address@not.available> wrote:
>
> Chris,
>
> > I don't think boot time would be affected by a DST switch, though.
> > It should be recorded in UTC.
>
> The point is, it /isn't/ a recorded constant (at least not on my machine).
> Its just dragged around with the clocks current time (as in: current time
> minus uptime).   And as such I could easily imagine a DST change will cause
> the "boot time" to change accordingly.
>

Yes, but even if it's not recorded as a timestamp but as an uptime
counter, that counter can be referenced against the current time in
UTC. A DST switch affects the displayed time, but not the internal
definition of "current time" (at least, not on Linux, where the system
clock should be in UTC - the rules are different on Windows, and may
also be different on other Unix-like OSes); if your current UTC time
is 1573072926 seconds and your uptime is 7469247.52 seconds, then you
can deduce that your system booted at 1565603679, and then convert
that to a displayable boot time in whatever timezone you like (for
instance, "Mon Aug 12 19:54:39 2019\n" which is what my ctime()
returns). A DST switch wouldn't affect any of this, assuming you have
the correct tzdata to figure out whether the boot time was on summer
or winter time.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to