-
Notifications
You must be signed in to change notification settings - Fork 23
Migrate from time to jiff library #297
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
base: main
Are you sure you want to change the base?
Conversation
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>
| } | ||
|
|
||
| #[allow(unused)] // really unused at present, but might be useful | ||
| pub(crate) trait ToOffsetDateTime { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
AGENTS.md will be in a separate PR focused on contributor guidelines. This PR should focus only on the jiff migration and code formatting.
Replaces
timecrate (v0.3) withjiff(v0.2.19) for cleaner time handling APIs and better timezone semantics.Key API Changes
Types:
OffsetDateTime→Timestamp(always UTC, no offset confusion)UtcOffset→TimeZoneMethods:
.unix_timestamp()→.as_second().nanosecond()→.subsec_nanosecond()OffsetDateTime::now_utc()→Timestamp::now()Benefits
TimeZone::system()vsUtcOffset::current_local_offset()Files Modified
src/unix_time.rs(simplified from 79 to 11 lines)src/{band,entry,change}.rs,src/index/entry.rs,src/source/entry.rssrc/transport/{local,sftp,s3}.rssrc/{show,bin/conserve,restore}.rstests/{old_archives,s3_integration}.rsAll modified files formatted with
cargo fmt(import ordering, line breaks).Original prompt
💡 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.