unix: add SysctlTimeval on *bsd and darwin

Change-Id: I18daa353d101e6636a732288c8276d9f68d25f90
Reviewed-on: https://go-review.googlesource.com/c/sys/+/244237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
Tobias Klauser
2020-07-22 17:55:00 +00:00
committed by Tobias Klauser
parent a8459c1583
commit 76b94024e4
2 changed files with 26 additions and 0 deletions
+9
View File
@@ -10,6 +10,7 @@ import (
"os/exec"
"runtime"
"testing"
"time"
"golang.org/x/sys/unix"
)
@@ -73,3 +74,11 @@ func TestSysctlClockinfo(t *testing.T) {
t.Logf("tick = %v, hz = %v, profhz = %v, stathz = %v",
ci.Tick, ci.Hz, ci.Profhz, ci.Stathz)
}
func TestSysctlTimeval(t *testing.T) {
tv, err := unix.SysctlTimeval("kern.boottime")
if err != nil {
t.Fatal(err)
}
t.Logf("boottime = %v", time.Unix(tv.Unix()))
}