f-86: hostsvc: relais DNS et NTP par hôte, socket de contrôle #86

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-25 20:32:06 +01:00
commit d4b83bdb17
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
20 changed files with 2235 additions and 0 deletions

View file

@ -0,0 +1,23 @@
//go:build linux
package hostsvc
import (
"time"
"golang.org/x/sys/unix"
)
type SystemClock struct{}
func (SystemClock) Now() time.Time { return time.Now() }
func (SystemClock) Sync() (bool, time.Duration, error) {
var tx unix.Timex
state, err := unix.Adjtimex(&tx)
if err != nil {
return false, 0, err
}
synced := state != unix.TIME_ERROR && tx.Status&unix.STA_UNSYNC == 0
return synced, time.Duration(tx.Maxerror) * time.Microsecond, nil
}