mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-02-01 11:34:59 +01:00
19 lines
308 B
Go
19 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
|
|
}
|