Skip to content

refactor: simplify system_time_to_timestamp - #14980

Merged
sylvestre merged 1 commit into
uutils:mainfrom
xtqqczze:uu-stat-system-time-to-timestamp
Nov 15, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
xtqqczze:uu-stat-system-time-to-timestamp

Conversation

@xtqqczze

Copy link
Copy Markdown
Collaborator

elide the time < UNIX_EPOCH branch by inlining system_time_to_sec

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/usage_vs_getopt (fails in this run but passes in the 'main' branch)

Comment thread src/uu/stat/src/stat.rs Resolved
@xtqqczze
xtqqczze force-pushed the uu-stat-system-time-to-timestamp branch from 0d8bffc to f3973e0 Compare October 9, 2026 22:19
@xtqqczze
xtqqczze force-pushed the uu-stat-system-time-to-timestamp branch from f3973e0 to 0562aa7 Compare October 17, 2026 23:04
@xtqqczze
xtqqczze requested a review from RenjiSann October 26, 2026 22:32
@xtqqczze
xtqqczze force-pushed the uu-stat-system-time-to-timestamp branch 2 times, most recently from 76dd0aa to 6585a74 Compare October 29, 2026 09:46
Comment thread src/uu/stat/src/stat.rs
Err(e) => {
let d = e.duration();
if d.subsec_nanos() == 0 {
(-(d.as_secs() as i64), 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add a test with a whole-second pre-epoch time (e.g. UNIX_EPOCH - Duration::from_secs(2)) to cover this branch? thanks

elide the `time < UNIX_EPOCH` branch by inlining `system_time_to_sec`
@sylvestre
sylvestre force-pushed the uu-stat-system-time-to-timestamp branch from 6585a74 to 9c25b1a Compare November 10, 2026 21:00
@sylvestre
sylvestre merged commit c31d4fb into uutils:main Nov 15, 2026
145 of 147 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

@xtqqczze
xtqqczze deleted the uu-stat-system-time-to-timestamp branch November 15, 2026 12:54
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