mirror of
https://github.com/jech/galene.git
synced 2024-11-26 10:35:59 +01:00
19 lines
297 B
Go
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)
|
|
}
|