-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: Prev() function derives the previous time a SpecSchedule would have triggered #437
base: master
Are you sure you want to change the base?
Conversation
…sed on time passed in
…lso copy/pasted in error; also add test cases
… test for Sao Paolo later, however Signed-off-by: Julie Vogelman <[email protected]>
…xt() function Signed-off-by: Julie Vogelman <[email protected]>
@@ -174,6 +174,103 @@ WRAP: | |||
return t.In(origLocation) | |||
} | |||
|
|||
// Prev returns the previous time this schedule is activated, less than the given | |||
// time. If no time can be found to satisfy the schedule, return the zero time. | |||
func (s *SpecSchedule) Prev(t time.Time) time.Time { |
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.
Not sure if it was wanted or not, but this function should be added to the Schedule interface for it to be accessible externally.
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.
Okay, I'll add it to the interface and to the ConstantDelaySchedule struct.
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.
okay, done
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.
There hasn't been any contribution to the repo since 2020 so let's hope that someone merges this! Thanks for implementing it though
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.
thanks
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.
…ntDelaySchedule struct Signed-off-by: Julie Vogelman <[email protected]>
Issue 322 requested this function to derive the previous time that a SpecSchedule would have triggered.
I am open to moving the logic if you think I should.
Also, I am not sure if it works in the Sao Paolo case. I was having trouble understanding that one in SpecSchedule.Next() in the code and test.