-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[x] Add OffsetClock constructor that uses given time delta #3354
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #3354 +/- ##
=======================================
Coverage 72.3% 72.3%
=======================================
Files 1098 1098
Lines 102112 102112
=======================================
Hits 73910 73910
Misses 23098 23098
Partials 5104 5104
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #3354 +/- ##
=======================================
Coverage 72.3% 72.3%
=======================================
Files 1098 1098
Lines 102112 102112
=======================================
Hits 73910 73910
Misses 23098 23098
Partials 5104 5104
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
* master: [x] Add OffsetClock constructor that uses given time delta (#3354)
@@ -35,7 +35,12 @@ func NewOffsetClock(offsetTime time.Time, nowFn NowFn) OffsetClock { | |||
return OffsetClock{nowFn: nowFn, timeDelta: offsetTime.Sub(nowFn())} | |||
} | |||
|
|||
// Now returns current time from the initial seed time value. | |||
// NewOffsetClockFromTimeDelta returns new offset clock that has time shifted by timeDelta duration. | |||
func NewOffsetClockFromTimeDelta(timeDelta time.Duration, nowFn NowFn) OffsetClock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to say, IMHO, if this is the only constructor that we intend to use, then we don't really need to keep the other one around (with all the tests specific to it).
What this PR does / why we need it:
Adds
OffsetClock
constructor that uses given time delta instead of a particulartime.Time
in the past/future.Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: