-
Notifications
You must be signed in to change notification settings - Fork 11
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
"time" builtin does not correctly report a third decimal digit #7
Comments
time
builtin does not correctly report a third decimal digit
I have researched this issue and I do not believe the In fact, I will continue to research this enhancement to help improve my familiarity of the code base. If a more experienced C programmer wants to complete this enhancement before I do, have at it. However, the ksh-community needs to decide on the details of such an enhancement: default precision level, changing the times alias into a some sort of builtin, and etc. |
thanks for looking into this. I suspected that the accuracy limitation is due to the called c function. this is not really bad in my view, but that changing the TIMEFORMAT to 3 digits w/o getting them, really, seems broken to me :). you are right that a better solution here will be to switch to but what about the |
I am not sure as to why ksh2020 decided to change The getrusage c function is capable of returning per process and overall process stats. A discussion should occur on how to approach this possible additional detail in use and output via |
Works for me with ksh93v:
Also spotted
Version ABIJM 93v- 2014-12-24 on FreeBSD 11.3-STABLE |
interesting. wild guess: maybe the freebsd
never shows a non-zero third digit in so many runs just like initially reported. |
The New KornShell book does not define precision of Here is the definition of
On my system I get:
On a random Linux system (Centos 6 with the 2.6.32-754.25.1.el6.x86_64 kernel and glibc-2.12-1.212.el6_10.3.x86_64) I get
KornShell works as designed I'd say. |
tend to agree. so the third digit you see on your system is not "real" either but approx equal to 1/128... so "works as designed" is correct I'd say. but the third digit just is not usable in the present implementation that uses times(3). I believe this is not desirable. whether it needs "fixing"? maybe. as @hyenias said, $SECONDS obviously uses something else with higher resolution which might possibly be utilized for |
Can someone mark this issue with an enhancement label? Thanks. |
by default
time
reports two decimal digits. this is controlled by the variableTIMEFORMAT
. changing the latter to, e,g,TIMEFORMAT=$'\nreal\t%3R\tuser\t%3U\tsys\t%3S'
enforces reporting of 3 decimal digits (more are not supported anyway according to manpage). however, the third digit is always reported as zero. example(the observed output is of course somewhat variable but the third digit is reported consistently as
0
).this is also broken in 93v- but works correctly in ksh2020.
such high precision timing (1 ms accuracy) usually is not of much relevance but it can be different during benchmarking when computing averages and standard deviations of multiple repeated runs.
The text was updated successfully, but these errors were encountered: