Skip to content

Commit

Permalink
Remove dependency on facebookgo/clock (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
robskillington authored May 9, 2018
1 parent 8adbfe9 commit 6f12159
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 0 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import:
version: ~3.1.0
subpackages:
- statsd
- package: github.com/facebookgo/clock
version: 600d898af40aa09a7a93ecb9265d87b0504b6f03
- package: github.com/prometheus/client_golang
version: ^0.8.0
subpackages:
Expand Down
4 changes: 1 addition & 3 deletions scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import (
"io"
"sync"
"time"

"github.com/facebookgo/clock"
)

var (
Expand All @@ -35,7 +33,7 @@ var (
// DefaultSeparator is the default separator used to join nested scopes
DefaultSeparator = "."

globalClock = clock.New()
globalNow = time.Now

defaultScopeBuckets = DurationBuckets{
0 * time.Millisecond,
Expand Down
8 changes: 4 additions & 4 deletions stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ func (t *timer) Record(interval time.Duration) {
}

func (t *timer) Start() Stopwatch {
return NewStopwatch(globalClock.Now(), t)
return NewStopwatch(globalNow(), t)
}

func (t *timer) RecordStopwatch(stopwatchStart time.Time) {
d := globalClock.Now().Sub(stopwatchStart)
d := globalNow().Sub(stopwatchStart)
t.Record(d)
}

Expand Down Expand Up @@ -367,11 +367,11 @@ func (h *histogram) RecordDuration(value time.Duration) {
}

func (h *histogram) Start() Stopwatch {
return NewStopwatch(globalClock.Now(), h)
return NewStopwatch(globalNow(), h)
}

func (h *histogram) RecordStopwatch(stopwatchStart time.Time) {
d := globalClock.Now().Sub(stopwatchStart)
d := globalNow().Sub(stopwatchStart)
h.RecordDuration(d)
}

Expand Down

0 comments on commit 6f12159

Please sign in to comment.