2020-03-23 22:41:10 -07:00
|
|
|
// Copyright The OpenTelemetry Authors
|
2024-02-29 07:05:28 +01:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2019-08-02 13:52:55 -07:00
|
|
|
|
2019-11-01 11:40:29 -07:00
|
|
|
package internal // import "go.opentelemetry.io/otel/sdk/internal"
|
2019-08-02 13:52:55 -07:00
|
|
|
|
2023-03-30 12:49:39 -07:00
|
|
|
import "time"
|
2019-08-02 13:52:55 -07:00
|
|
|
|
|
|
|
// MonotonicEndTime returns the end time at present
|
|
|
|
// but offset from start, monotonically.
|
|
|
|
//
|
|
|
|
// The monotonic clock is used in subtractions hence
|
|
|
|
// the duration since start added back to start gives
|
|
|
|
// end as a monotonic time.
|
|
|
|
// See https://golang.org/pkg/time/#hdr-Monotonic_Clocks
|
|
|
|
func MonotonicEndTime(start time.Time) time.Time {
|
|
|
|
return start.Add(time.Since(start))
|
|
|
|
}
|