Repository navigation
find: parse -newerXt dates with parse_datetime, in local time - #915
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #915 +/- ##
=======================================
Coverage 92.57% 92.58%
=======================================
Files 37 37
Lines 7746 7750 +4
Branches 393 391 -2
=======================================
+ Hits 7171 7175 +4
Misses 435 435
Partials 140 140 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing |
|
Commit 9634207 has test result changes: bfs testsuite: |
| @@ -403,38 +402,17 @@ fn convert_arg_to_comparable_value_and_suffix( | |||
| /// When (time) is not provided, it will be automatically filled in as 00:00:00 | |||
There was a problem hiding this comment.
this doc comment is now wrong (UTC timestamps, only one format)
please replace it with a single line
| "2000-01-01T00:00", | ||
| "1 Jan 2000", | ||
| "@946684800", | ||
| "yesterday", |
There was a problem hiding this comment.
these only check that it doesn't fail
could you please add a test which checks the selected files, with TZ set, so the local time part is covered?
There was a problem hiding this comment.
Added find_newermt_uses_local_time in dc967d5. It creates two files with mtimes of 23:00 and 04:00 UTC on either side of 2000-01-01. With TZ=UTC0, -newermt '2000-01-01 03:00:00' selects only the later file; with TZ=UTC-5 it selects both. On the old parser, which read the date as UTC, the UTC-5 case selects only the later file.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Commit dc967d5 has test result changes: bfs testsuite: |
|
Thanks for your PR |
-newermtand the other-newerXtpredicates accept onlyYYYY-MM-DD[ HH:MM:SS]andMon DD[, YYYY][ HH:MM:SS], and read them as UTC. GNU find takes anydate -dstring and uses local time:The same error comes for
yesterday,1 day ago,@1792540800,2026-10-16T00:00:00,Oct 16 2026,10/16/2026and2026-10-16 10:00 +0000. With TZ=Asia/Kolkata,-newermt '2026-10-20 05:00:00'was also 5.5 hours off.parse_date_str_to_timestampsnow callsparse_datetime::parse_datetime, the parserdate -dandtouch -duse in coreutils, as suggested in #384. An empty string still means the start of today, like GNU.parse_datetime0.17 is a new dependency; it builds for wasm32-wasip1. #871 (chrono to jiff) rewrites the same function; whichever lands second needs a small rebase.The unit test now computes its expected values in local time, so it passes in any time zone, and it covers
@epoch, an explicit offset,1 Jan 2025andyesterday.find_newer_xyalso runs those forms on the command line and fails without the change.cargo test: 429 passed, clippy and fmt clean, also under TZ=UTC, Asia/Kolkata and America/New_York. With TZ=Asia/Kolkata, 21 of 22 date strings select the same files as GNU find 4.10.0 (the error text for an invalid one differs only in the program name); the other one hits files whose mtime equals the reference time exactly, fixed in #914. Four of them were also checked under UTC and America/New_York.Part of #384.