Skip to content
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

Merged
merged 3 commits into from
Mar 15, 2021

Conversation

vpranckaitis
Copy link
Collaborator

What this PR does / why we need it:

Adds OffsetClock constructor that uses given time delta instead of a particular time.Time in the past/future.

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE

Copy link
Collaborator

@soundvibe soundvibe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #3354 (ffc31c5) into master (ffc31c5) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3354   +/-   ##
=======================================
  Coverage    72.3%    72.3%           
=======================================
  Files        1098     1098           
  Lines      102112   102112           
=======================================
  Hits        73910    73910           
  Misses      23098    23098           
  Partials     5104     5104           
Flag Coverage Δ
aggregator 76.8% <0.0%> (ø)
cluster 84.9% <0.0%> (ø)
collector 84.3% <0.0%> (ø)
dbnode 78.9% <0.0%> (ø)
m3em 74.4% <0.0%> (ø)
m3ninx 73.6% <0.0%> (ø)
metrics 19.8% <0.0%> (ø)
msg 74.6% <0.0%> (ø)
query 66.9% <0.0%> (ø)
x 80.3% <0.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffc31c5...57d9670. Read the comment docs.

@vpranckaitis vpranckaitis enabled auto-merge (squash) March 15, 2021 12:34
@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #3354 (ffc31c5) into master (ffc31c5) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3354   +/-   ##
=======================================
  Coverage    72.3%    72.3%           
=======================================
  Files        1098     1098           
  Lines      102112   102112           
=======================================
  Hits        73910    73910           
  Misses      23098    23098           
  Partials     5104     5104           
Flag Coverage Δ
aggregator 76.8% <0.0%> (ø)
cluster 84.9% <0.0%> (ø)
collector 84.3% <0.0%> (ø)
dbnode 78.9% <0.0%> (ø)
m3em 74.4% <0.0%> (ø)
m3ninx 73.6% <0.0%> (ø)
metrics 19.8% <0.0%> (ø)
msg 74.6% <0.0%> (ø)
query 66.9% <0.0%> (ø)
x 80.3% <0.0%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffc31c5...57d9670. Read the comment docs.

@vpranckaitis vpranckaitis merged commit 19b4e4e into master Mar 15, 2021
@vpranckaitis vpranckaitis deleted the vilius/offset_clock_time_delta branch March 15, 2021 12:41
soundvibe added a commit that referenced this pull request Mar 15, 2021
* 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 {
Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants