Skip to content

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

Merged
astafan8 merged 8 commits into
masterfrom
copilot/fix-timestamp-rendering
Aug 25, 2026
Merged

Handle qcodes timestamp timezone format change and render timestamps in local time#467
astafan8 merged 8 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
@astafan8
astafan8 marked this pull request as ready for review August 25, 2026 06:02
@astafan8
astafan8 enabled auto-merge August 25, 2026 06:03
Comment thread test/pytest/test_qcodes_data.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for timezone-aware QCoDeS timestamps and renders them in the machine’s local timezone.

Changes:

  • Parses legacy and offset-aware timestamps.
  • Updates dataset-info expectations for the new format.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plottr/data/qcodes_dataset.py Converts aware timestamps to local time.
test/pytest/test_qcodes_data.py Updates timestamp expectations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread plottr/data/qcodes_dataset.py
Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
auto-merge was automatically disabled August 25, 2026 06:12

Head branch was pushed to by a user without write access

Copilot AI requested a review from astafan8 August 25, 2026 06:14
Copilot AI and others added 2 commits August 25, 2026 10:08
Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
Comment thread pyproject.toml Outdated
@astafan8
astafan8 enabled auto-merge August 25, 2026 11:51
@astafan8

Copy link
Copy Markdown
Collaborator

@copilot please address one open comment and fix CI

Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
auto-merge was automatically disabled August 25, 2026 12:03

Head branch was pushed to by a user without write access

Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
Copilot AI requested a review from astafan8 August 25, 2026 12:07
Comment thread test_requirements.txt Outdated
Co-authored-by: astafan8 <15662810+astafan8@users.noreply.github.com>
@astafan8
astafan8 merged commit bcbff8a into master Aug 25, 2026
2 checks passed
@astafan8
astafan8 deleted the copilot/fix-timestamp-rendering branch August 25, 2026 14:10
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.

4 participants