Skip to content

Use jiff for ZIP timestamps#36

Merged
charliermarsh merged 3 commits into
mainfrom
codex/minimize-zip-metadata
May 12, 2026
Merged

Use jiff for ZIP timestamps#36
charliermarsh merged 3 commits into
mainfrom
codex/minimize-zip-metadata

Conversation

@charliermarsh

@charliermarsh charliermarsh commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

Replace the optional chrono timestamp support with an optional jiff feature, matching the sync zip crate's Jiff-facing API direction.

When jiff is enabled, new ZipEntry values now default their last-modified timestamp to the current UTC time via Jiff. When it is disabled, writes keep using the deterministic MS-DOS epoch timestamp of 1980-01-01 00:00:00.

This keeps ZipDateTime::default() deterministic while adding ZipDateTime::default_for_write() for feature-sensitive write defaults.

Changes

  • Replace the chrono feature/dependency with optional jiff.
  • Add ZipDateTime::{as_jiff, from_jiff} and Jiff conversion impls behind jiff.
  • Use ZipDateTime::default_for_write() when constructing new entries.
  • Keep the dev zip dependency from enabling its default timestamp/compression feature set.
  • Add coverage for deterministic defaults without Jiff and current-time defaults with Jiff.

Validation

  • cargo fmt --all --check
  • cargo test --lib default_
  • cargo test --lib --features jiff default_
  • cargo test --lib
  • cargo test --lib --all-features
  • cargo check --no-default-features --features full-wasm --lib
  • cargo clippy --lib -- -D warnings
  • cargo clippy --lib --all-features -- -D warnings

@charliermarsh charliermarsh changed the title [codex] Normalize default ZIP timestamps Normalize default ZIP timestamps May 12, 2026
@charliermarsh charliermarsh requested a review from woodruffw May 12, 2026 18:00
@charliermarsh charliermarsh marked this pull request as ready for review May 12, 2026 18:04
@charliermarsh charliermarsh changed the title Normalize default ZIP timestamps [codex] Use Jiff for ZIP timestamps May 12, 2026
Comment thread Cargo.toml Outdated
zstd = ["async-compression/zstd"]
xz = ["async-compression/xz"]
deflate64 = ["async-compression/deflate64"]
jiff-02 = ["dep:jiff"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit (not a blocker): slightly inconsistent with the other feature names, although I personally like this name-version pattern 🙂

@charliermarsh charliermarsh marked this pull request as draft May 12, 2026 19:11
@charliermarsh charliermarsh changed the title [codex] Use Jiff for ZIP timestamps Use jiff for ZIP timestamps May 12, 2026
@charliermarsh charliermarsh marked this pull request as ready for review May 12, 2026 19:14
@charliermarsh charliermarsh merged commit bb739d8 into main May 12, 2026
7 checks passed
@charliermarsh charliermarsh deleted the codex/minimize-zip-metadata branch May 12, 2026 19:19
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