package time

import "go.opentelemetry.io/otel/sdk/metric/controller/time"

Index

Types

type Clock

type Clock interface {
	Now() time.Time
	Ticker(duration time.Duration) Ticker
}

Clock keeps track of time for a metric SDK.

type RealClock

type RealClock struct {
}

RealClock wraps the time package and uses the system time to tell time.

func (RealClock) Now

func (RealClock) Now() time.Time

Now returns the current time.

func (RealClock) Ticker

func (RealClock) Ticker(period time.Duration) Ticker

Ticker creates a new RealTicker that will tick with period.

type RealTicker

type RealTicker struct {
	// contains filtered or unexported fields
}

RealTicker wraps the time package and uses system time to tick time intervals.

func (RealTicker) C

func (t RealTicker) C() <-chan time.Time

C returns a channel that receives the current time when RealTicker ticks.

func (RealTicker) Stop

func (t RealTicker) Stop()

Stop turns off the RealTicker.

type Ticker

type Ticker interface {
	Stop()
	C() <-chan time.Time
}

Ticker signals time intervals.

Source Files

time.go

Version
v0.31.0
Published
Jul 8, 2022
Platform
darwin/amd64
Imports
1 packages
Last checked
6 hours ago

Tools for package owners.