mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
25 lines
505 B
Go
25 lines
505 B
Go
|
package clock
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// DefaultClock implements Clock interface by simply calling the appropriate
|
||
|
// time functions.
|
||
|
type DefaultClock struct{}
|
||
|
|
||
|
// NewDefaultClock constructs a new DefaultClock.
|
||
|
func NewDefaultClock() Clock {
|
||
|
return &DefaultClock{}
|
||
|
}
|
||
|
|
||
|
// Now simply returns time.Now().
|
||
|
func (DefaultClock) Now() time.Time {
|
||
|
return time.Now()
|
||
|
}
|
||
|
|
||
|
// TickAfter simply wraps time.After().
|
||
|
func (DefaultClock) TickAfter(duration time.Duration) <-chan time.Time {
|
||
|
return time.After(duration)
|
||
|
}
|