[Git][NTPsec/ntpsec][master] ntpclients/ntpviz.py: replace deprecated function.

Gary E. Miller (@garyedmundsmiller) gitlab at mg.gitlab.com
Sat Dec 14 03:01:22 UTC 2024



Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
4da90e6e by Gary E. Miller at 2024-12-13T18:51:10-08:00
ntpclients/ntpviz.py: replace deprecated function.

datetime.datetime.utcfromtimestamp(t)
to
datetime.datetime.fromtimestamp(tp, datetime.UTC)

Should work back to at least 2.7

- - - - -


1 changed file:

- ntpclients/ntpviz.py


Changes:

=====================================
ntpclients/ntpviz.py
=====================================
@@ -1811,10 +1811,10 @@ tbody tr:nth-child(6n+6) {
 
     # Ugh.  Not clear what to do in the multiplot case
     if len(statlist) == 1:
-        start_time = datetime.datetime.utcfromtimestamp(
-            stats.starttime).strftime('%c')
-        end_time = datetime.datetime.utcfromtimestamp(
-            stats.endtime).strftime('%c')
+        start_time = datetime.datetime.fromtimestamp(
+            stats.starttime, datetime.UTC).strftime('%c')
+        end_time = datetime.datetime.fromtimestamp(
+            stats.endtime, datetime.UTC).strftime('%c')
 
         index_header += '<b>Start Time:</b> %s UTC<br>\n' \
                         '<b>End Time:</b> %s UTC<br>\n' \



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/4da90e6e717257832427fd7183d3093bb0dc8156

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/4da90e6e717257832427fd7183d3093bb0dc8156
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20241214/9ec37799/attachment-0001.htm>


More information about the vc mailing list