package runner import ( "time" "golang.org/x/sys/unix" ) // hostClock on macOS: the monotonic clock that keeps counting in sleep // and the boot session's UUID. type hostClock struct{} func (hostClock) Read() (ClockReading, error) { var ts unix.Timespec if err := unix.ClockGettime(unix.CLOCK_MONOTONIC, &ts); err != nil { return ClockReading{}, err } boot, err := unix.Sysctl("kern.bootsessionuuid") if err != nil { return ClockReading{}, err } return ClockReading{Wall: time.Now(), Elapsed: time.Duration(ts.Nano()), BootID: boot}, nil }