Skip to content

Commit 67b2220

Browse files
committed
Refactor: Timestamp parsing to handle timezone information
Use `datetime.fromisoformat` instead of `datetime.strptime`
1 parent 43055f0 commit 67b2220

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/powerapi/report/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _extract_timestamp(ts):
126126
if isinstance(ts, str):
127127
try:
128128
# ISO 8601 date format
129-
return datetime.strptime(ts, "%Y-%m-%dT%H:%M:%S.%f")
129+
return datetime.fromisoformat(ts)
130130
except ValueError:
131131
# Unix timestamp format (in milliseconds)
132132
return datetime.fromtimestamp(int(ts) / 1000)

0 commit comments

Comments
 (0)