coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

date/ls: Switch from chrono to jiff

Open drinkcat opened this issue 5 months ago • 3 comments

jiff handling of timezones makes our life so much easier. Also, jiff provides a convenient feature to only embed the timezone database when necessary (e.g. Windows).

  • Fixes #7497, #7498, #7659.
  • Helps with #7504, but still adds an extra ~300k compared to a chrono-only solution (that did not fix all issues, FWIW):
-rwxr-xr-x 2 drinkcat drinkcat 4828144 Apr 27 13:57 target/release/date ## HEAD
-rwxr-xr-x 2 drinkcat drinkcat 3279432 Apr 28 15:42 target/release/date ## jiff
-rwxr-xr-x 2 drinkcat drinkcat 2949080 Apr 27 13:58 target/release/date ## with #7849

Part of the tests taken from #7597 (@jadijadi FYI), then refactored on top of those to add more test cases.

@BurntSushi thanks for your support!

--

Cross.toml: Install tzdata in container

Linux tests require that now, as we now assume /usr/share/zoneinfo is present.

test_date: Extend coverage to a lot more timezones

Also test %z/%Z formats.

date: Add more TZ tests

[drinkcat: separated test changes]

ls: switch to lenient formating configuration

ls: Avoid additional String creation/copy in display_date

From code provided in #7852 by @BurntSushi.

Depending on the benchmarks, there is still a small performance difference (~4%) vs main, but it's seen mostly on small trees getting printed repeatedly, which is probably not a terribly interesting use case.

ls: cache recent time threshold in jiff implementation

ls: convert to jiff

Revert "ls: Optimize time formatting"

This reverts commit fc6b896c271eed5654418acc267eb21377c55690.

This also reverts the change from new to new_lenient, we'll recover that later as part of the jiff conversion.

date: switch from chrono to jiff

Also adds cargo dependency.

drinkcat avatar May 07 '25 02:05 drinkcat