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

scheduling: fix scheduling times in UTC timezone instead of local time #160

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

maurerle
Copy link
Collaborator

@maurerle maurerle commented Feb 2, 2025

When using the RecurrentScheduledTime, I would expect to have the time interpreted in UTC.

Conversion between timestamp and datetime is generally depending on the host timezone.

For example:

>>> datetime.fromtimestamp(0, tz=timezone.utc).replace(tzinfo=None)
datetime.datetime(1970, 1, 1, 0, 0)
>>> datetime.fromtimestamp(0)
datetime.datetime(1970, 1, 1, 1, 0)

>>> datetime(1970,1,1).timestamp()
-3600.0
>>> import calendar
>>> calendar.timegm(datetime(1970,1,1).utctimetuple())
0

For a simulation tool, this is rather not expected as this gives different results depending on the host location, so I would rather expect it to use UTC wherever possible.
This is done in this PR, though remaining occurances in test functions of datetime.timestamp() are still present.

@maurerle maurerle requested a review from rcschrg February 2, 2025 10:17
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.19%. Comparing base (3695e9f) to head (bffc1a2).
Report is 8 commits behind head on development.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #160      +/-   ##
===============================================
+ Coverage        89.11%   89.19%   +0.07%     
===============================================
  Files               22       22              
  Lines             2490     2498       +8     
===============================================
+ Hits              2219     2228       +9     
+ Misses             271      270       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rcschrg rcschrg merged commit 0f38af0 into development Feb 5, 2025
10 checks passed
@maurerle maurerle deleted the fix_utc branch February 5, 2025 11:53
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