gitlab.com/gitlab-org/labkit@v1.21.0/log/clock.go (about)

     1  package log
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // Clock interface provides the time.
     8  type clock interface {
     9  	Now() time.Time
    10  }
    11  
    12  // realClock is the default time implementation.
    13  type realClock struct{}
    14  
    15  // Now returns the time.
    16  func (realClock) Now() time.Time { return time.Now() }
    17  
    18  // stubClock is the default time implementation.
    19  type stubClock struct {
    20  	StubTime time.Time
    21  }
    22  
    23  // Now returns a stub time.
    24  func (c *stubClock) Now() time.Time { return c.StubTime }