Skip to content

Fix Windows file time conversion (from FILETIME to unix time) - #608

Merged
bootandy merged 3 commits into
bootandy:masterfrom
adithya-n05:adithya_n05/windows-filetime
Aug 18, 2026
Merged

Fix Windows file time conversion (from FILETIME to unix time)#608
bootandy merged 3 commits into
bootandy:masterfrom
adithya-n05:adithya_n05/windows-filetime

Conversation

@adithya-n05

@adithya-n05 adithya-n05 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Hi Andy! I'm Adithya, I met you on Thursday earlier this week

I wanted to practice contributing to some open source projects like you suggested, and I thought I'd start by contributing to dust!

This PR fixes the following:

  • For windows machines, dust reads time values in platform.rs as FILETIME values. Those are 100 nanosecond intervals since 1601 (i.e. not unix timestamps)
  • These will be later passed to chrono by calls to get_pretty_file_modified_time in display.rs and here chrono will expect unix time

Correction:

  • Added a conversion function to convert filetime to unix timestamps if on a windows machine, and tests. Replaced all timestamp reads to call this function.

@adithya-n05 adithya-n05 changed the title WIP: Fix Windows file time conversion Fix Windows file time conversion (from FILETIME to unix time) Aug 15, 2026
@adithya-n05
adithya-n05 marked this pull request as ready for review August 15, 2026 22:04
Copilot AI lite review requested due to automatic review settings August 15, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes Windows timestamp handling by converting NTFS FILETIME (100ns ticks since 1601) into Unix epoch seconds before those values are used for filtering and for chrono-based formatting, preventing incorrect time behavior on Windows.

Changes:

  • Added a Windows-only FILETIME -> Unix seconds conversion helper and applied it to all Windows metadata time reads.
  • Added Windows-only integration tests covering --filetime modified output and --mtime filtering behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_flags.rs Adds Windows-specific integration tests for --filetime and --mtime.
src/platform.rs Converts Windows metadata timestamps from FILETIME to Unix epoch seconds before returning them.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_flags.rs
Comment thread tests/test_flags.rs
@bootandy

Copy link
Copy Markdown
Owner

Hi yes I remember you.

In advance I'm not reliably online so I apologise in advance if I don't reply.

It would be good to have someone looking after the windows build - because I don't have a windows box myself.

@bootandy

Copy link
Copy Markdown
Owner

i think your reasoning is ok but the tests currently fail. I think the copilot review comments are worth looking at.

@adithya-n05

Copy link
Copy Markdown
Contributor Author

@bootandy I've fixed the failing tests and addressed the copilot feedback

When you may have a chance, could you please approve the workflow so CI can run again?

@bootandy
bootandy merged commit 17d6cd5 into bootandy:master Aug 18, 2026
18 checks passed
@adithya-n05
adithya-n05 deleted the adithya_n05/windows-filetime branch August 18, 2026 22:20
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.

3 participants