diff --git a/utils/mono/mono.go b/utils/mono/mono.go index 3a9491a9..624daaa8 100644 --- a/utils/mono/mono.go +++ b/utils/mono/mono.go @@ -1,3 +1,17 @@ +// Copyright 2023 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mono import "time" @@ -12,7 +26,7 @@ func FromTime(t time.Time) time.Time { } func Now() time.Time { - return FromTime(time.Now()) + return epoch.Add(time.Since(epoch)) } func UnixNano() int64 { @@ -20,5 +34,5 @@ func UnixNano() int64 { } func UnixMicro() int64 { - return (epochNano + int64(time.Since(epoch))) / 1000 + return UnixNano() / 1000 }