mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 16:37:27 +00:00
18 lines
308 B
Go
18 lines
308 B
Go
//go:build linux || darwin
|
|
|
|
package utils
|
|
|
|
import (
|
|
"time"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
func MonotonicRaw() (time.Time, error) {
|
|
ts := unix.Timespec{}
|
|
if err := unix.ClockGettime(unix.CLOCK_MONOTONIC_RAW, &ts); err != nil {
|
|
return time.Time{}, err
|
|
}
|
|
s, ns := ts.Unix()
|
|
return time.Unix(s, ns), nil
|
|
}
|