sbw@naucse.UUCP (Steve Wampler) (02/09/90)
I suppose this is well known, and it's certainly minor, but it just bit me. The code for clock() is incorrect. It uses an initial sentinel value of 0L to determine if this is the first call or not. Since time resolution is 1/60th of a second, it is possible for the first call to store a 0L back into the sentinel, making the second call look like another first call. (This occurs if the first call happens within the first 1/60th of a second of execution time.) Changing the sentinel value to -1L fixes the problem (it's unlikely that that value will show up naturally...). -- Steve Wampler {....!arizona!naucse!sbw}