Repository navigation
find: show the year for old files in -ls - #904
SichenLiang wants to merge 1 commit into
Conversation
-ls and -fls always printed the time of day in the date column. Print it only for timestamps from 180 days before find started through one hour after it, and print the year outside that window. Keep the column in UTC with English month names.
Merging this PR will not alter performance
|
There was a problem hiding this comment.
where does the exact 180 days / 1 hour window come from?
the manual doesn't say, so i'd like to know how it was checked
There was a problem hiding this comment.
Those numbers came from probing GNU findutils 4.11.0 not the manual. With LC_ALL=C and TZ=UTC0, I set a file's mtime relative to the start of each run and checked whether find -ls printed the time or the year.
At exactly 180 days old (15,552,000 seconds), GNU still prints the time; one second older gets the year. The future boundary is the same that is exactly 3,600 seconds ahead still gets the time, while 3,601 seconds gets the year. I repeated the one-second boundary checks three times and also tried several nearby offsets.
It is not the six-month cutoff used by ls: a file 15,778,476 seconds old already gets the year from GNU find. This PR matched GNU at every point I checked.

-lsand-flsalways printed the time of day in the date column, even for old files. GNU find prints the time only for timestamps from 180 days before find started through one hour after it, and prints the year outside that window.GNU shows
Jun 15 2020here; uutils showedJun 15 12:00. The column still uses UTC and English month names.Fixes #898