Skip to content

find: pad the day with a space in -printf %t, %a and %c - #917

Merged
sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:find-printf-ctime-day-padding
Oct 24, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
jayhemnani9910:find-printf-ctime-day-padding

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

-printf %t (and %a, %c) print the time in the ctime format, where a single-digit day is padded with a space. uutils zero-pads it:

$ TZ=UTC0 touch -d '2020-01-02 03:04:05' f; TZ=UTC0 find f -printf '%t\n'
GNU 4.10.0:  Thu Jan  2 03:04:05.0000000000 2020
uutils:      Thu Jan 02 03:04:05.0000000000 2020

The format now uses %e instead of %d. %Tc and the other %T/%A/%C directives already matched GNU.

New unit test test_printf_ctime_pads_day_with_space (fails with %d). cargo test passes (431), clippy is clean. %t, %a and %c on a file dated 2 January give the same output as GNU find.

These print the time like ctime(3), where a day below 10 is space-padded (Jan  2); the format used %d and printed Jan 02.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 06:11

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 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.

@codspeed

codspeed Bot commented Oct 23, 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:find-printf-ctime-day-padding (e5fab16) with main (cc32b4f)

Open in CodSpeed

@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.61%. Comparing base (cc32b4f) to head (e5fab16).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #917      +/-   ##
==========================================
+ Coverage   92.59%   92.61%   +0.01%     
==========================================
  Files          37       37              
  Lines        7766     7786      +20     
  Branches      394      394              
==========================================
+ Hits         7191     7211      +20     
  Misses        435      435              
  Partials      140      140              

☔ 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.

@sylvestre
sylvestre merged commit fa5a228 into uutils:main Oct 24, 2026
34 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

@jayhemnani9910
jayhemnani9910 deleted the find-printf-ctime-day-padding branch November 13, 2026 14:32
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