github.com/decred/dcrlnd@v0.7.6/clock/default_clock.go (about)

     1  package clock
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // DefaultClock implements Clock interface by simply calling the appropriate
     8  // time functions.
     9  type DefaultClock struct{}
    10  
    11  // NewDefaultClock constructs a new DefaultClock.
    12  func NewDefaultClock() Clock {
    13  	return &DefaultClock{}
    14  }
    15  
    16  // Now simply returns time.Now().
    17  func (DefaultClock) Now() time.Time {
    18  	return time.Now()
    19  }
    20  
    21  // TickAfter simply wraps time.After().
    22  func (DefaultClock) TickAfter(duration time.Duration) <-chan time.Time {
    23  	return time.After(duration)
    24  }