Skip to content

date: fix -s UTC conversion losing timezone offset#10828

Draft
yachi wants to merge 1 commit intouutils:mainfrom
yachi:fix-date-set-utc-conversion
Draft

date: fix -s UTC conversion losing timezone offset#10828
yachi wants to merge 1 commit intouutils:mainfrom
yachi:fix-date-set-utc-conversion

Conversation

@yachi
Copy link

@yachi yachi commented Feb 8, 2026

Fixes #10800

-s with -u reinterpreted wall-clock time as UTC, losing the timezone offset. Now preserves the absolute instant when converting to UTC.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/usage_vs_getopt (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)


#[test]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
fn test_date_set_utc_with_offset() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this actually tests anything, it just checks to see if the user is root and fails. Maybe it would be better to add a unit test for this for the conversion?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see there's other integration tests in here that use the -s flag, can you follow the format of those tests?

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/mv/mv-special-1. tests/mv/mv-special-1 is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/pr/bounded-memory is no longer failing!
Note: The gnu test tests/dd/no-allocate is now being skipped but was previously passing.

@yachi yachi force-pushed the fix-date-set-utc-conversion branch from d84e70b to b760fd7 Compare February 12, 2026 22:11
@yachi yachi marked this pull request as draft February 12, 2026 22:25
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/tail/pipe-f. tests/tail/pipe-f is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test tests/factor/t33 is no longer failing!
Congrats! The gnu test tests/factor/t34 is no longer failing!
Congrats! The gnu test tests/factor/t36 is no longer failing!
Note: The gnu test tests/pr/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/printf/printf-surprise is now passing!

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.

date: -u -s "10:30 EST" sets wrong time

2 participants