stat: truncate fractional pre-epoch timestamps toward zero - #14975
mattsu2020 wants to merge 2 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
GNU testsuite comparison: |
|
Should we fix |
Should we pass the original sign to format_scaled_decimal? |
|
I’m not particularly fond of the existing approach. It might be worth considering whether we should use a crate that explicitly supports rounding, such as |
rust_decimal makes sense if we want to share rounding behavior across utilities like stat, printf, numfmt, and seq. |
Merging this PR will degrade performance by 2.31%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
|
Benchmark variance tracked by #14921. |
Fractional pre-epoch timestamps round away from zero when reducing precision, so
%.3Yprints-0.877instead of-0.876. Truncate fractional output toward zero while preserving floor-based integer seconds and the sign of negative values truncated to zero. Add Rust regression tests.Refs #14705 (stat/stat-nanoseconds.sh).
Validated with 10 stat unit tests, 39 stat integration tests, rustfmt, and clippy.
close #14976