-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
sopel: using utcnow and fixing minor issues with datetime #2005
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exirel
added
Tweak
Bugfix
Generally, PRs that reference (and fix) one or more issue(s)
labels
Dec 19, 2020
dgw
reviewed
Dec 25, 2020
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.
More little ideas on a 99%-there PR.
dgw
approved these changes
Dec 26, 2020
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.
🎉 and ready to squash (as is PR 2006, even though I forgot to say so)
Three important changes in one commit: The first was to switch from `datetime`'s `now()` to `utcnow()`, because DST exists and we need to take that into account. The second one is to switch from `timedelta`'s `seconds` to `total_seconds()`, because, believe it or not, but a timedelta of exactly one day means `dt.seconds == 0`. The last one is a fix for a TODO that has been bugging me since I read it. Now, when there is a "fatal" error, we decrease the error count by one per every full 5s that passed since the last error. Maybe we should do that every time, but I figured it would be an acceptable tradeoff for now.
Co-authored-by: dgw <dgw@technobabbl.es>
Exirel
force-pushed
the
internal-datetime-utc
branch
from
December 29, 2020 16:04
44bcaf0
to
cc3d5d1
Compare
And done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is related to #1647. It doesn't fix it but we may consider it done nonetheless.
What I looked at was how we use datetime internally and in various plugins, to check if everything was working fine. Result is: no, but it's OK, I fixed it with this PR.
The biggest issue I found was a repeated usage of
timedelta.seconds
that I replaced bytimedelta.total_seconds()
.Checklist
make qa
(runsmake quality
andmake test
)