Commit 9808b07
authored
Rollup merge of rust-lang#141009 - emmanuel-ferdman:master, r=marcoieni
Migrate to modern datetime API
# PR Summary
This small PR resolves the `datetime` library warnings:
```python
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). or datetime.datetime.utcnow()
```
Note that `.replace(tzinfo=None)` allows to keep the original behavior where the time appears as a naive UTC timestamp (i.e., without any timezone offset). Comparision:
```python
# With .utcnow() or .now(datetime.timezone.utc).replace(tzinfo=None)
Time,Idle
2025-05-14T15:40:25.013414,98.73417721518987
# With .now(datetime.timezone.utc)
Time,Idle
2025-05-14T15:40:25.013414+00:00,98.73417721518987
```1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
0 commit comments