-
Notifications
You must be signed in to change notification settings - Fork 8
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
Use "aware" datetimes #48
Merged
leandro-lucarella-frequenz
merged 2 commits into
frequenz-floss:v0.x.x
from
llucax:fix-now
Nov 17, 2022
Merged
Use "aware" datetimes #48
leandro-lucarella-frequenz
merged 2 commits into
frequenz-floss:v0.x.x
from
llucax:fix-now
Nov 17, 2022
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
leandro-lucarella-frequenz
added
priority:high
Address this as soon as possible
type:bug
Something isn't working
labels
Nov 16, 2022
github-actions
bot
added
part:channels
Affects channels implementation
part:tests
Affects the unit, integration and performance (benchmarks) tests
labels
Nov 16, 2022
Signed-off-by: Leandro Lucarella <leandro.lucarella@frequenz.com>
When creating datetimes we need to make sure to include timezone information, otherwise we will get exceptions raised when comparing to other "aware" datetime objects. Using "native" datetime object (without timezone information) is very dangerous as we might mix datetimes created for different timezones without knowing, introducing very obscure bugs. More info about "aware" and "native" datetimes: https://docs.python.org/3/library/datetime.html#aware-and-naive-objects Signed-off-by: Leandro Lucarella <leandro.lucarella@frequenz.com>
leandro-lucarella-frequenz
force-pushed
the
fix-now
branch
from
November 16, 2022 12:30
b4ae9d7
to
4ff417d
Compare
For more context, this is affecting some tests in the SDK, which was really hard to figure out. |
leandro-lucarella-frequenz
requested a review
from sahas-subramanian-frequenz
November 16, 2022 12:34
sahas-subramanian-frequenz
approved these changes
Nov 16, 2022
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.
Oops, that makes sense. Thanks Luca!
It is quite inconvenient (:hankey:) that Python doesn't use "aware" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
part:channels
Affects channels implementation
part:docs
Affects the documentation
part:tests
Affects the unit, integration and performance (benchmarks) tests
priority:high
Address this as soon as possible
type:bug
Something isn't working
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.
When creating datetimes we need to make sure to include timezone information, otherwise we will get exceptions raised when comparing to other "aware" datetime objects. Using "native" datetime object (without timezone information) is very dangerous as we might mix datetimes created for different timezones without knowing, introducing very obscure bugs.
More info about "aware" and "native" datetimes: https://docs.python.org/3/library/datetime.html#aware-and-naive-objects