summaryrefslogtreecommitdiff
path: root/internal/clock/real.go
blob: 29fcdd8f2b48368b3b7dbfe0553b8e0613f9b1b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package clock

import (
	"time"
)

// New returns a new real clock.
func New() *Real {
	return &Real{}
}

// Real is the implementation of a clock.Provider for production.
type Real struct{}

// Now return the current time.
func (Real) Now() time.Time {
	return time.Now()
}

// After return a channel receiving the time after the defined duration.
func (Real) After(d time.Duration) <-chan time.Time {
	return time.After(d)
}

func (Real) AfterFunc(d time.Duration, f func()) *time.Timer {
	return time.AfterFunc(d, f)
}

var (
	_ Provider = (*Real)(nil)
)