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

Update utils.py #756

Closed
wants to merge 1 commit into from
Closed

Conversation

PatientLightning
Copy link

Hello,

removed use of astimezone because it throws an error for times before the epoch on windows platforms and replaced it with timezone and timedelta functions instead

Reference Issue
#725

removed use of astimezone because it throws an error for times before the epoch
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Member

@oddstr13 oddstr13 left a comment

Choose a reason for hiding this comment

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

This implementation is naive, and does not take into account that the UTC offset can change.

https://www.youtube.com/watch?v=-5wpm-gesOY

I've added tests for this now, but I haven't managed to get windows CI working (at all, nor with changing timezones for testing), so I don't really have any way of testing alternative solutions for windows.

I would very much like for this timezone calculation to happen in a standard library, and not be implemented in the addon code, as it is as good as impossible to get it right, and keep it right. Please see the linked YouTube video for inspiration for staying away from time code (shudder).

It is tempting to simply return the UTC timestamp for dates below epoch, but I haven't decided if that's a good idea yet.

@oddstr13 oddstr13 closed this Oct 21, 2023
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.

2 participants