Hi,

Franco Martelli wrote:
> ~# export TIMEFORMAT='real    %3R
> user    %3U
> sys     %3S'

The manual and the source code say that the format variable is "TIME"
not "TIMEFORMAT".
  https://sources.debian.org/src/time/1.9-0.2/src/time.c/#L656

It seems to understand the two characters "\n" as line break.
Further: "real" would better match "%e" or "%E",

  $ export TIME="real   %e sec\nuser   %U sec\nsys    %S sec"
  $ /usr/bin/time echo

  real   0.00 sec
  user   0.00 sec
  sys    0.00 sec
  $

The number formats are hardcoded:

  https://sources.debian.org/src/time/1.9-0.2/src/time.c/#L526
    case 'S':           /* System time.  */
      fprintf (fp, "%ld.%02ld",

  https://sources.debian.org/src/time/1.9-0.2/src/time.c/#L531
     case 'U':          /* User time.  */
       fprintf (fp, "%ld.%02ld",

  https://sources.debian.org/src/time/1.9-0.2/src/time.c/#L552
     case 'e':          /* Elapsed real time in seconds.  */
       fprintf (fp, "%ld.%02ld",

There is no interpreter to see for adjustable number precision.


Have a nice day :)

Thomas

Reply via email to