[comp.unix.sysv386] problem with time command?

john@beaudin.UUCP (John Beaudin) (12/20/90)

On SCO Unix 3.2.2, the results of 
	$ /bin/time sleep 10
are
	real 5.9

The Csh time gives a value of 0:10.
Is /bin/time known to be incorrect?
-- 
My .signature is awaiting apropriate display technology

jfh@rpp386.cactus.org (John F Haugh II) (12/21/90)

In article <1471@beaudin.UUCP> john@beaudin.UUCP (John Beaudin) writes:
>On SCO Unix 3.2.2, the results of 
>	$ /bin/time sleep 10
>are
>	real 5.9
>
>The Csh time gives a value of 0:10.
>Is /bin/time known to be incorrect?

Sounds like someone forgot to set their HZ variable correctly -

% HZ=50 /bin/time /bin/sleep 10

real         9.2
user         0.0
sys          0.1
% HZ=100 /bin/time /bin/sleep 10

real         4.7
user         0.0
sys          0.0
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh@rpp386.cactus.org
"While you are here, your wives and girlfriends are dating handsome American
 movie and TV stars. Stars like Tom Selleck, Bruce Willis, and Bart Simpson."

jtc@van-bc.wimsey.bc.ca (J.T. Conklin) (12/22/90)

In article <1471@beaudin.UUCP> john@beaudin.UUCP (John Beaudin) writes:
>On SCO Unix 3.2.2, the results of 
>	$ /bin/time sleep 10
>are
>	real 5.9
>
>The Csh time gives a value of 0:10.
>Is /bin/time known to be incorrect?

From this description, and a similar expirence on a Motorola MPC, I
think that /bin/time is dividing the number of clock ticks as returned
by the times() system call by 100 rather than 60.  

I think that the /bin/time source compiles in the value of HZ from
<sys/param.h>.  If the header file is incorrect, then the wrong value
must have been compiled in.

I don't know why csh gets it right.  Perhaps it reads HZ from the
environment?

	--jtc

-- 
J.T. Conklin	Toolsmith, Language Lawyer
		...!{uunet,ubc-cs}!van-bc!jtc, jtc@wimsey.bc.ca

sef@kithrup.COM (Sean Eric Fagan) (12/22/90)

In article <1054@van-bc.wimsey.bc.ca> jtc@van-bc.wimsey.bc.ca (J.T. Conklin) writes:
>In article <1471@beaudin.UUCP> john@beaudin.UUCP (John Beaudin) writes:
>>On SCO Unix 3.2.2, the results of 
>>	$ /bin/time sleep 10
>>are
>>	real 5.9

On kithrup:

kithrup 1296$ /bin/time sleep 10

real        9.9
user        0.0
sys         0.0

>>The Csh time gives a value of 0:10.
>>Is /bin/time known to be incorrect?

I'd say, from experimentation, that it isn't incorrect.

I don't know what's wrong with your system; I suspect that you have changed
HZ somewhere (maybe by unsetting it?).  Do an

	echo $HZ

and see what it says (kithrup says 60).

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef@kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.

jim@segue.segue.com (Jim Balter) (12/23/90)

In article <1054@van-bc.wimsey.bc.ca> jtc@van-bc.wimsey.bc.ca (J.T. Conklin) writes:
] I think that the /bin/time source compiles in the value of HZ from
] <sys/param.h>.  If the header file is incorrect, then the wrong value
] must have been compiled in.
]
] I don't know why csh gets it right.  Perhaps it reads HZ from the
] environment?

Correct programs use sysconf() instead of sys/param.h.