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

Export mono.FromDuration.

This commit is contained in:
Juliusz Chroboczek 2020-06-01 01:32:28 +02:00
parent 5b92226860
commit f851622191
2 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@ import (
var epoch = time.Now()
func fromDuration(d time.Duration, hz uint32) uint64 {
func FromDuration(d time.Duration, hz uint32) uint64 {
return uint64(d) * uint64(hz) / uint64(time.Second)
}
@ -15,7 +15,7 @@ func toDuration(tm uint64, hz uint32) time.Duration {
}
func Now(hz uint32) uint64 {
return fromDuration(time.Since(epoch), hz)
return FromDuration(time.Since(epoch), hz)
}
func Microseconds() uint64 {

View file

@ -6,7 +6,7 @@ import (
)
func TestDuration(t *testing.T) {
a := fromDuration(time.Second, 48000)
a := FromDuration(time.Second, 48000)
if a != 48000 {
t.Errorf("Expected 48000, got %v", a)
}