Skip to content

Handle qcodes timestamp timezone format change and render timestamps in local time - #467

Draft
astafan8 with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-timestamp-rendering
Draft

Handle qcodes timestamp timezone format change and render timestamps in local time#467
astafan8 with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-timestamp-rendering

Conversation

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Upcoming qcodes changes the default render format of run_timestamp()/completed_timestamp() (and raw_time_to_str_time) from "%Y-%m-%d %H:%M:%S" to "%Y-%m-%d %H:%M:%S%z", so timestamps now carry the local UTC offset (e.g. 2026-07-31 10:27:25+0200). This audits where plottr consumes those strings and ensures rendered timestamps use the machine's local timezone.

Changes

  • _split_timestamp (plottr/data/qcodes_dataset.py): converts timezone-aware timestamps to the local (PC) timezone via datetime.astimezone() before formatting, drops the offset from the split date/time, and handles both legacy and %z formats; returns ('', '') on any parse/convert error.
  • test_get_ds_info (test/pytest/test_qcodes_data.py): previously sliced the raw string (ts[11:]), which now includes +0200 and mismatches get_ds_info(). Reuses _split_timestamp to build expected values.

Notes on impact

  • The plot info panel (Started:/Finished:) passes the raw qcodes string through, so it will now display the offset suffix — accurate and already local; left unchanged.
  • _qcodes_db_overview.py::_format_timestamp renders from raw unix floats via datetime.fromtimestamp (local time) and is unaffected.
# aware input rendered in the PC's local timezone (UTC here); legacy input preserved
_split_timestamp("2026-07-31 10:27:25+0200")  # -> ("2026-07-31", "08:27:25")
_split_timestamp("2026-07-31 10:27:25")       # -> ("2026-07-31", "10:27:25")

Copilot AI and others added 2 commits August 24, 2026 08:25
Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
Copilot AI changed the title Handle qcodes timestamp timezone format change and render timestamps in local timezone Handle qcodes timestamp timezone format change and render timestamps in local time Aug 24, 2026
Copilot AI requested a review from astafan8 August 24, 2026 08:27
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 this pull request may close these issues.

2 participants