mirror of
https://github.com/jech/galene.git
synced 2024-11-14 12:45:58 +01:00
20 lines
297 B
Go
20 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)
|
||
|
}
|