1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 10:45:58 +01:00
galene/mono/mono.go

20 lines
297 B
Go
Raw Normal View History

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)
}