Skip to content

find: print -ls times in local time - #922

Merged
sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:ls-local-time
Oct 26, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:ls-local-time

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

-ls and -fls format the modification time in UTC. GNU find, ls -l and this find's own -printf %t use the local time zone, so on any machine not in UTC the -ls column is off by the UTC offset:

$ TZ=Asia/Kolkata find f1.txt -printf '%t\n' -ls
Mon Oct 26 01:07:24.7048425880 2026
 940823      4 -rw-------   1 po  po  3 Oct 25 19:37 f1.txt     # GNU find 4.10.0: Oct 26 01:07

The date is now converted to chrono::Local before formatting, in both the unix and the Windows -ls paths. With TZ=UTC0 the output is unchanged.

Test find_ls_uses_local_time sets a file's mtime to an hour ago and checks the -ls column under TZ=UTC-5 (fails on main). cargo test: all pass (test_find 86, 85 on main), clippy and fmt clean. Same column as GNU find 4.10.0 under TZ=Asia/Kolkata, UTC-5, UTC0 and America/New_York.

#904 changes the same two lines (year for old files) and keeps UTC; whichever lands second needs a one-line rebase.

The -ls date column was formatted in UTC; GNU find and -printf %t use
the local time zone.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 03:03

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

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

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.65%. Comparing base (505421d) to head (cc35665).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #922   +/-   ##
=======================================
  Coverage   92.65%   92.65%           
=======================================
  Files          37       37           
  Lines        7837     7837           
  Branches      393      393           
=======================================
  Hits         7261     7261           
  Misses        435      435           
  Partials      141      141           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Oct 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 15 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 20 untouched benchmarks


Comparing jayhemnani9910:ls-local-time (cc35665) with main (505421d)

Open in CodSpeed

@sylvestre
sylvestre merged commit 82cfc21 into uutils:main Oct 26, 2026
34 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

@jayhemnani9910
jayhemnani9910 deleted the ls-local-time branch November 13, 2026 14:31
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