Skip to content

Timestamp parsing failure with timezone information #586

New issue

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

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

Already on GitHub? Sign in to your account

Open
KellianL opened this issue Apr 10, 2025 · 0 comments · May be fixed by #587
Open

Timestamp parsing failure with timezone information #586

KellianL opened this issue Apr 10, 2025 · 0 comments · May be fixed by #587

Comments

@KellianL
Copy link

Description

The current implementation of _extract_timestamp() in src/powerapi/report/report.py, fails to parse valid ISO 8601 timestamps that include timezone information (e.g., '2025-04-03T12:36:20.800232411+00:00').
The function only handles ISO 8601 timestamps without timezone information.

Expected Behavior

The function should successfully parse ISO 8601 timestamps with timezone information.

Current Behavior

The function raises a ValueError when parsing timestamps with timezone information.

Example code

from datetime import datetime
from powerapi.report.report import Report

timestamp = '2025-04-03T12:36:20.800232411+00:00'

try:
    ts = Report._extract_timestamp(timestamp)
    print(f"Timestamp: {ts}")
except ValueError as e:
    print(f"Error: {e}")

Versions

powerapi : 2.10.0
python : 3.13.2

Optional notes

  • datetime.fromisoformat() was added in Python 3.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant