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

Simplify code for getting current timezone; fix timestamp format #2372

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

iarspider
Copy link
Contributor

No description provided.

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @iarspider for branch master.

@aandvalenzuela, @cmsbuild, @iarspider, @smuzaffar can you please review it and eventually sign? Thanks.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.
cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

cmsbuild commented Nov 13, 2024

cms-bot internal usage

@smuzaffar
Copy link
Contributor

@iarspider , did you check if this will work during DST ?

@iarspider
Copy link
Contributor Author

Yes:

  • Actual time
>>> import time
>>> time.localtime()
time.struct_time(tm_year=2024, tm_mon=11, tm_mday=13, tm_hour=18, tm_min=2, tm_sec=19, tm_wday=2, tm_yday=318, tm_isdst=0)
>>> time.localtime().tm_gmtoff
3600
>>> datetime.datetime.strptime("2024-11-13 13:00", "%Y-%m-%d %H:%M").replace(tzinfo=currenttz()).astimezone(datetime.timezone.utc)
datetime.datetime(2024, 11, 13, 12, 0, tzinfo=datetime.timezone.utc)
  • After changing the clock to DST:
>>> import time
>>> time.localtime()
time.struct_time(tm_year=2024, tm_mon=10, tm_mday=20, tm_hour=18, tm_min=0, tm_sec=50, tm_wday=6, tm_yday=294, tm_isdst=1)
>>> time.localtime().tm_gmtoff
7200
>>> datetime.datetime.strptime("2024-11-13 13:00", "%Y-%m-%d %H:%M").replace(tzinfo=currenttz()).astimezone(datetime.timezone.utc)
datetime.datetime(2024, 11, 13, 11, 0, tzinfo=datetime.timezone.utc)

@smuzaffar
Copy link
Contributor

+externals

@smuzaffar smuzaffar merged commit cca4912 into master Nov 13, 2024
3 of 4 checks passed
@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs after it passes the integration tests. This pull request will now be reviewed by the release team before it's merged. @sextonkennedy, @mandrenguyen, @rappoccio, @antoniovilela (and backports should be raised in the release meeting by the corresponding L2)

@smuzaffar smuzaffar deleted the fix-tz branch November 14, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants