Skip to content

Use UTC with 'Z' suffix for timestamps to avoid ambiguity#369

Closed
Copilot wants to merge 4 commits intodevelopfrom
copilot/use-utc-for-timestamps
Closed

Use UTC with 'Z' suffix for timestamps to avoid ambiguity#369
Copilot wants to merge 4 commits intodevelopfrom
copilot/use-utc-for-timestamps

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Timestamps were generated using naive datetime.now(), causing ambiguity in environments with different timezone configurations (e.g., Docker containers vs. host systems).

Changes

  • mmif/serialize/mmif.py: Generate timestamps using datetime.now(timezone.utc) for explicit UTC awareness
  • mmif/serialize/model.py: Encoder converts UTC timestamps from ISO format +00:00 to Z suffix (only for timezone.utc instances)
  • tests/test_serialize.py: Added verification that timestamps are UTC-aware and serialize with 'Z' suffix

Example

mmif_obj = Mmif(...)
view = mmif_obj.new_view()
# timestamp is now datetime.now(timezone.utc)

serialized = mmif_obj.serialize()
# "timestamp": "2026-02-19T00:44:05.618086Z"  (was "2026-02-19T00:44:05.618086")

The encoder preserves non-UTC timezone offsets unchanged (e.g., +05:00) and only applies the 'Z' conversion to timestamps explicitly in UTC.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/clamsproject/mmif-python/git/refs/tags
    • Triggering command: /usr/bin/curl curl --silent -H Authorization: token ****** REDACTED (http block)
  • https://api.github.com/repos/clamsproject/mmif/git/refs/tags
    • Triggering command: /usr/bin/curl curl --silent -H Authorization: token ****** REDACTED (http block)
  • https://api.github.com/repos/clamsproject/mmif/tags
    • Triggering command: `/usr/bin/python3 /usr/bin/python3 -c
      exec(compile('''

This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py

- It imports setuptools before invoking setup.py, to enable projects that directly

import from distutils.core to work with newer packaging standards.

#` (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Use UTC (Z) for timestamps to avoid ambiguity</issue_title>
<issue_description>### New Feature Summary

Currently, mmif-python outputs timestamps in local time without specifying a timezone offset. This can lead to ambiguity, especially when mmif files are processed or generated within Docker containers where system timezone data might be missing, inconsistent, or set to UTC by default, differing from the host's or developer's local time.

This feature request proposes standardizing the timestamp output to always use UTC, indicated by the 'Z' (Zulu time) suffix, to ensure clarity and consistency across different environments.

Related

No response

Alternatives

No response

Additional context

No response</issue_description>

<agent_instructions>look at

new_view.metadata.timestamp = datetime.now()
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 19, 2026 00:40
Co-authored-by: keighrim <9062727+keighrim@users.noreply.github.com>
Co-authored-by: keighrim <9062727+keighrim@users.noreply.github.com>
Co-authored-by: keighrim <9062727+keighrim@users.noreply.github.com>
Copilot AI changed the title [WIP] Update timestamp output to use UTC for consistency Use UTC with 'Z' suffix for timestamps to avoid ambiguity Feb 19, 2026
Copilot AI requested a review from keighrim February 19, 2026 00:47
@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 71.65%. Comparing base (a6db461) to head (b1eca88).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
mmif/serialize/model.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #369      +/-   ##
===========================================
- Coverage    71.66%   71.65%   -0.01%     
===========================================
  Files           22       22              
  Lines         2915     2918       +3     
===========================================
+ Hits          2089     2091       +2     
- Misses         826      827       +1     
Flag Coverage Δ
unittests 71.65% <85.71%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@keighrim keighrim closed this Feb 27, 2026
@keighrim keighrim deleted the copilot/use-utc-for-timestamps branch February 27, 2026 00:01
@github-project-automation github-project-automation bot moved this from Todo to Done in infra Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Use UTC (Z) for timestamps to avoid ambiguity

2 participants