From f851622191c156c58793ab074e35f93de6366b6f Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Mon, 1 Jun 2020 01:32:28 +0200 Subject: [PATCH] Export mono.FromDuration. --- mono/mono.go | 4 ++-- mono/mono_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mono/mono.go b/mono/mono.go index 82ba5c7..bfc6fb5 100644 --- a/mono/mono.go +++ b/mono/mono.go @@ -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 { diff --git a/mono/mono_test.go b/mono/mono_test.go index 26c2e13..63d65d1 100644 --- a/mono/mono_test.go +++ b/mono/mono_test.go @@ -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) }