tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern.boottime drift after boot?



I have a system which records the output of "sysctl -n kern.boottime"
as part of a dhcpcd-exit.hook to ensure some processing only occurs
once per boot.

Except... it doesn't quite work as the value appears to not be
constant for a given boot.

I have one case where the value recorded by dhcpcd-exit.hook called during rc is
1696860044
but the value of sysctl -n kern.boottime is now
1696860043

sysctl(7) states:

     kern.boottime (KERN_BOOTTIME)
             A struct timespec structure is returned.  This structure contains
             the time that the system was booted.  That time is defined (for
             this purpose) to be the time at which the kernel first started
             accumulating clock ticks.

I'm assuming it's calculated as some form of offset - maybe it would
be better as an absolute value. If not, and it can drift about, then
I'll at least update the manpage and look for a different mechanism
for my 'once per boot' :)

David


Home | Main Index | Thread Index | Old Index