github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/db/clock.go (about)

     1  package db
     2  
     3  import "time"
     4  
     5  //go:generate counterfeiter . Clock
     6  
     7  type Clock interface {
     8  	Now() time.Time
     9  	Until(time.Time) time.Duration
    10  }
    11  
    12  type realClock struct{}
    13  
    14  func NewClock() realClock {
    15  	return realClock{}
    16  }
    17  
    18  func (c *realClock) Now() time.Time {
    19  	return time.Now()
    20  }
    21  
    22  func (c *realClock) Until(t time.Time) time.Duration {
    23  	return time.Until(t)
    24  }