Skip to content

Migrate from time to jiff library#297

Draft
Copilot wants to merge 9 commits intomainfrom
copilot/convert-time-library-to-jiff
Draft

Migrate from time to jiff library#297
Copilot wants to merge 9 commits intomainfrom
copilot/convert-time-library-to-jiff

Conversation

Copy link

Copilot AI commented Feb 8, 2026

Replaces time crate (v0.3) with jiff (v0.2.19) for cleaner time handling APIs and better timezone semantics.

Key API Changes

Types:

  • OffsetDateTimeTimestamp (always UTC, no offset confusion)
  • UtcOffsetTimeZone

Methods:

  • .unix_timestamp().as_second()
  • .nanosecond().subsec_nanosecond()
  • OffsetDateTime::now_utc()Timestamp::now()

Benefits

  • Explicit UTC semantics (Timestamp is always UTC)
  • Built-in serde support without feature flags
  • Handles pre-epoch times correctly
  • Cleaner timezone API: TimeZone::system() vs UtcOffset::current_local_offset()

Files Modified

  • Core: src/unix_time.rs (simplified from 79 to 11 lines)
  • Time handling: src/{band,entry,change}.rs, src/index/entry.rs, src/source/entry.rs
  • Transport: src/transport/{local,sftp,s3}.rs
  • Display: src/{show,bin/conserve,restore}.rs
  • Tests: tests/{old_archives,s3_integration}.rs

All modified files formatted with cargo fmt (import ordering, line breaks).

Original prompt

Could you draft a PR that converts from using the time library to using the newer jiff, and assess if that's cleaner or simpler?


💡 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 8, 2026 17:59
Co-authored-by: sourcefrog <346355+sourcefrog@users.noreply.github.com>
Co-authored-by: sourcefrog <346355+sourcefrog@users.noreply.github.com>
Co-authored-by: sourcefrog <346355+sourcefrog@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert from time library to jiff for improved clarity Migrate from time to jiff for cleaner date/time handling Feb 8, 2026
Copilot AI requested a review from sourcefrog February 8, 2026 18:08
}

#[allow(unused)] // really unused at present, but might be useful
pub(crate) trait ToOffsetDateTime {
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot maybe just delete this now, unless it's actually used?

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot actually please see if more of this file can be reduced or deleted?

Copy link
Author

Choose a reason for hiding this comment

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

Simplified in commit 26345ae. Removed all three traits (ToTimestamp, ToFileTime, FromUnixAndNanos) and replaced with:

  • Simple helper functions for the two needed conversions
  • jiff's built-in Timestamp::try_from(SystemTime) for SystemTime conversions

The file went from 79 lines to 18 lines.

… built-in conversions

Co-authored-by: sourcefrog <346355+sourcefrog@users.noreply.github.com>
Co-authored-by: sourcefrog <346355+sourcefrog@users.noreply.github.com>
Co-authored-by: sourcefrog <346355+sourcefrog@users.noreply.github.com>
Copilot AI changed the title Migrate from time to jiff for cleaner date/time handling Add code formatting and pre-commit guidelines Feb 8, 2026
Copilot stopped work on behalf of sourcefrog due to an error February 8, 2026 19:30
AGENTS.md will be in a separate PR focused on contributor guidelines.
This PR should focus only on the jiff migration and code formatting.
Copilot AI changed the title Add code formatting and pre-commit guidelines Migrate from time to jiff library Feb 8, 2026
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