I am writing a script that synchronizes the system clock with the hardware clock (aka RTC, or CMOS clock) assuming that no Network Time Protocol (NTP) daemon is running.
I am running in a virtual machine and the supervisor doesn't let the hardware clock to be changed by the guest.
So in linux, I can use the hwclock --hctosys
to do this, in Debian for example:
$ date
Thu May 18 00:48:57 UTC 2017
$ date 0401121621
Thu Apr 1 12:16:00 UTC 2021
$ hwclock --hctosys # this set my system clock to the hardware clock back again
$ date
Thu May 18 00:49:28 UTC 2017
But how can I do the same thing on FreeBSD as it doesn't provide the hwclock utility? I tried using adjkerntz -a
but it didn't work.
I am running FreeBSD version 11.0-RELEASE-p9
Thanks for your help