2018-01-10 12:30 GMT+01:00 Maximilian Pichler <maxim.pich...@gmail.com>:

> My vague understanding of how OpenBSD keeps track of time is:
>
> * At boot the software clock (the value returned by gettimeofday) is
> initialized from the hardware clock (the one with the coin-shaped
> battery).
>
>
Not available on all platforms, in which case the kernel sometimes just
grabs the latest timestamp of the filesystem and takes it from there.


> * The software clock is then incremented hz(9) times a second by a CPU
> interrupt.
> My question is: Can OpenBSD be told initialize the software from the
> hardware clock again after the system is booted?
>
>
How would one try to know which is more exact?

For some/most platforms, the (multiple) internal timers are crazy exact
down to
counting cycles in the CPU, and others are not so exact and skew based on
CPU
load and other factors. (I think the obsd-on-mac68k used to suffer from
cpu-time-skew)
For emulated and virtual machines, its even worse, since the guest usually
can't tell
when the host decided to switch cpu frequency based on load or other
factors, throwing
off all kinds of "1 us is X loops in this microsleep routine" calibrations
one might have made
early on.


> (Also, is the hardware clock ever modified aside from explicit
> invocations of date(1) or similar?)
>

-- 
May the most significant bit of your life be positive.

Reply via email to