mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 07:07:33 -04:00
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:
committed by
Tobias Klauser
parent
a8459c1583
commit
76b94024e4
@@ -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()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user