github.com/scaleft/monotime@v0.0.0-20180209174256-2da272f3dad0/monotime_legacy.go (about)

     1  // +build !go1.9
     2  
     3  package monotime
     4  
     5  import "time"
     6  
     7  type Monotime uint64
     8  
     9  type timer struct {
    10  	start Monotime
    11  }
    12  
    13  func newTimer() *timer {
    14  	return &timer{
    15  		start: monotime(),
    16  	}
    17  }
    18  
    19  func (t *timer) Elapsed() time.Duration {
    20  	return duration(t.start, monotime())
    21  }