Search code examples
pdksh

pdksh time built-in function does not work


$ time -p sleep 5
real 8.33
user 0.00
sys 0.00

$ /usr/bin/time -p sleep 5
real 5.00
user 0.00
sys 0.00

$ echo $KSH_VERSION
@(#)PD KSH v5.2.14 99/07/13.2

I have noticed this issue: on Red Hat Enterprise Linux Server release 6.8 (Santiago). and on Red Hat Enterprise Linux Client release 5.8 (Tikanga).

Any help is welcome.


Solution

  • At least I have found the maintainer of a fork of pdksh that had the same problem. He has fixed the bug:github.com/Orc/pdksh/commit/5d...

    The symbol CLK_TCK has been removed from a C header by an evil standardisation commitee. As a result pdksh was using a default value (60) instead of the correct value that can be displayed using the following command:

    $ getconf CLK_TCK
    100
    

    If you need a quick and dirty patch, you can either download the source of the rpm and fix the value in ksh_time.h or you can install the fork.