1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00
galene/mono/mono.go
2020-05-03 11:06:08 +02:00

19 lines
297 B
Go

package mono
import (
"time"
)
var epoch = time.Now()
func fromDuration(d time.Duration, hz uint32) uint64 {
return uint64(d) * uint64(hz) / uint64(time.Second)
}
func Now(hz uint32) uint64 {
return fromDuration(time.Since(epoch), hz)
}
func Microseconds() uint64 {
return Now(1000000)
}