linuxkit/pkg/host-timesync-daemon
Avi Deitcher 76b519705b
Add alpine bcc tools (#4105)
* Update linuxkit/alpine

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* tools/alpine: Update to latest

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* tools: Update to the latest linuxkit/alpine

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* Update use of tools to latest

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* tests: Update packages to the latest linuxkit/alpine

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* Update use of test packages to latest

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* pkgs: Update packages to the latest linuxkit/alpine

Signed-off-by: Avi Deitcher <avi@deitcher.net>

* Update package tags

Signed-off-by: Avi Deitcher <avi@deitcher.net>

---------

Signed-off-by: Avi Deitcher <avi@deitcher.net>
2025-02-17 11:12:49 +02:00
..
vendor pkg/host-timesync-daemon bump x/sys version 2024-07-16 12:23:24 +03:00
build.yml move pkg config from Dockerfile to build.yml 2018-04-24 00:59:09 +02:00
Dockerfile Add alpine bcc tools (#4105) 2025-02-17 11:12:49 +02:00
go.mod pkg/host-timesync-daemon bump x/sys version 2024-07-16 12:23:24 +03:00
go.sum pkg/host-timesync-daemon bump x/sys version 2024-07-16 12:23:24 +03:00
main.go Remove dead or redundant code 2022-10-09 15:33:42 +02:00
README.md Add pkg/host-timesync-daemon 2017-07-07 11:35:36 +01:00

host-timesync-daemon

Some hypervisors (e.g. hyperkit / xhyve) don't provide a good way to keep the VM's clock in sync with the Host's clock. NTP will usually keep the clocks together, but after the host or VM is suspended and resumed the clocks can be suddenly too far apart for NTP to work properly.

This simple daemon listens on an AF_VSOCK port. When a connection is received, the daemon

  • reads the (hypervisor's virtual) hardware clock via RTC_RD_TIME on /dev/rtc0
  • calls settimeofday to set the time in the VM
  • closes the connection

Note the hardware clock has only second granularity so you will still need NTP (or some other process) to keep the clocks closely synchronised.

To use this, simply connect to the AF_VSOCK port when you want the clock to be resynchronised. If you want to wait for completion then read from the socket -- EOF means the resychronisation is complete.