Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc/cmds] Fix time command hour wrapping problem #1722

Merged
merged 1 commit into from
Sep 15, 2023
Merged

[libc/cmds] Fix time command hour wrapping problem #1722

merged 1 commit into from
Sep 15, 2023

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Sep 15, 2023

Fixes time command sometimes displaying incorrect results, reported by @Vutshi in #1619 (comment).

time would report incorrect results (e.g. an extremely large number) when a command would execute for a period of time where the number of seconds since Jan , 1970 would "wrap" during a modulo 3600 operation. Long story short, previously time used microsecond time calculations with a 32-bit long which was subjected to the improper 3600 second modulo operation approximately every hour GMT. It has been rewritten to use 64-bit arithmetic and is no longer subject to any time modulus.

The times C library routine has been removed due to being incorrect, and an alternative method used to get times in time.

@Vutshi, time sl -s should display properly now, although I don't expect you to actually wait 34 minutes to test it!

@Vutshi
Copy link

Vutshi commented Sep 15, 2023

although I don't expect you to actually wait 34 minutes to test it!

This shall be done.

@ghaerr ghaerr merged commit 69a1c08 into master Sep 15, 2023
2 checks passed
@ghaerr ghaerr deleted the time branch September 15, 2023 19:05
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.

2 participants