Commit e70f547
committed
tools/checkcerts.py: fix deprecated datetime.datetime.utcnow()
The replacement, datetime.datetime.now(datetime.UTC), returns a
tz-aware item, so the expiry time must also be timezone-aware.
datetime.strptime() does not handle that time format sanely.
I don't know why.
Luckily zoneinfo exists and can parse likely timezones into valid
datetime.tzinfo instances, as far as I can tell. Why isn't this part
of datetime? I don't know. But this code seems be somewhat reliable
(assuming the timezone name is the last item in the date string,
delimited by spaces).
Signed-off-by: Dan Mick <dan.mick@redhat.com>1 parent cf9d52c commit e70f547
1 file changed
+10
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| |||
0 commit comments