Skip to content

Commit

Permalink
[bugfix] Calculate time provider time correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Feb 16, 2019
1 parent ea04a8c commit a2c35ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/timer/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var SysSleepConsumer = func(d time.Duration) { time.Sleep(d) }

// NewFixedTimeProviderFromNanoSeconds creates a time provider from long nano seconds that always returns a fixed time
func NewFixedTimeProviderFromNanoSeconds(timestamp int64) TimeProvider {
sec := timestamp / 1e9
nSec := (timestamp - sec) * 1e9
sec := int64(timestamp / 1e9)
nSec := timestamp - sec*1e9
return func() time.Time {
return time.Unix(sec, nSec)
}
Expand Down

0 comments on commit a2c35ea

Please sign in to comment.