Skip to content

fix ZIP timestamps across time zones - #1033

Open
Guflly wants to merge 1 commit into
ouch-org:mainfrom
Guflly:fix/zip-local-timestamps
Open

fix ZIP timestamps across time zones#1033
Guflly wants to merge 1 commit into
ouch-org:mainfrom
Guflly:fix/zip-local-timestamps

Conversation

@Guflly

@Guflly Guflly commented Jul 27, 2026

Copy link
Copy Markdown

Fixes #902.

ZIP stores modification times as timezone-naive local clock values. Ouch previously treated those values as UTC during extraction and wrote UTC clock values when creating archives, shifting file times by the local UTC offset.

Archive creation now converts filesystem timestamps to the applicable local offset before writing the ZIP timestamp. Extraction resolves the local offset for the stored date and converts that clock value back to the corresponding filesystem timestamp, including historical daylight-saving offsets.

Tests cover a fixed non-UTC offset and the host's actual local offset.

Validation:

  • cargo test --no-default-features --features unrar,use_zlib,use_zstd_thin (103 passed)
  • rustfmt --edition 2024 --check --config newline_style=Native src/archive/zip.rs
  • cargo clippy --bin ouch --no-default-features --features unrar,use_zlib,use_zstd_thin

@Guflly
Guflly marked this pull request as ready for review July 27, 2026 17:59
@valoq

valoq commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

LGTM

Note, there should be a changelog entry for the fix

@valoq valoq self-assigned this Jul 28, 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.

Files from extracted zip have wrong modified time

2 participants