Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use timezone-aware datetime.datetime.now() #805

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

4n3w
Copy link

@4n3w 4n3w commented Apr 12, 2024

Replace deprecated datetime.datetime.utcnow() with timezone-aware datetime.datetime.now()

This change addresses a deprecation warning for python 3.12 by using datetime.datetime.now() with datetime.timezone.utc, ensuring the timestamp remains in UTC and conforms to newer best practices.

Copy link

@kovyrin kovyrin left a comment

Choose a reason for hiding this comment

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

Tested it in my environment and it works

@senderic
Copy link

Works for me too

~ curl https://raw.githubusercontent.com/4n3w/speedtest-cli/fix_datetime_utcnow_deprecation/speedtest.py | python3 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 65352  100 65352    0     0   263k      0 --:--:-- --:--:-- --:--:--  263k
Retrieving speedtest.net configuration...
Testing from Spectrum (a.b.c.d)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Airlink Internet Inc (Los Angeles, CA) [167.30 km]: 20.176 ms
Testing download speed................................................................................
Download: 196.26 Mbit/s
Testing upload speed......................................................................................................
Upload: 10.62 Mbit/s

@4n3w
Copy link
Author

4n3w commented Aug 19, 2024

I guess someone with write access would have to merge this, summoning @sivel

@SantiiRepair
Copy link

image

you should update that too

@ckujau
Copy link

ckujau commented Sep 20, 2024

duplicate of #801 (and would be included in #799 also)?

@teddy931130
Copy link

hey guys, just FYI this is still a thing:

image

@SantiiRepair
Copy link

SantiiRepair commented Feb 8, 2025 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants