Commit f8516221 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Export mono.FromDuration.

parent 5b922268
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
var epoch = time.Now() 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) return uint64(d) * uint64(hz) / uint64(time.Second)
} }
...@@ -15,7 +15,7 @@ func toDuration(tm uint64, hz uint32) time.Duration { ...@@ -15,7 +15,7 @@ func toDuration(tm uint64, hz uint32) time.Duration {
} }
func Now(hz uint32) uint64 { func Now(hz uint32) uint64 {
return fromDuration(time.Since(epoch), hz) return FromDuration(time.Since(epoch), hz)
} }
func Microseconds() uint64 { func Microseconds() uint64 {
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
) )
func TestDuration(t *testing.T) { func TestDuration(t *testing.T) {
a := fromDuration(time.Second, 48000) a := FromDuration(time.Second, 48000)
if a != 48000 { if a != 48000 {
t.Errorf("Expected 48000, got %v", a) t.Errorf("Expected 48000, got %v", a)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment