How to measure time between two events ?

How to measure time between two events ?

Post by Kwok-ping Ch » Tue, 16 Jan 1996 04:00:00



        I want to measure the time between two events, say the time between two keyboard input with accuracy of 1 milliseconds. I have tried the function "clock()" but it seem I have misuse it since it returns junk result.

        Thank you in advance

Bye

Chan Kwok Ping


 
 
 

How to measure time between two events ?

Post by Stephen Masterm » Thu, 18 Jan 1996 04:00:00


Quote:>    I want to measure the time between two events, say the time between
>two keyboard input with accuracy of 1 milliseconds. I have tried the function
>"clock()" but it seem I have misuse it since it returns junk result.

Maybe you could use the gettimeofday() function at the beginning and end of
the interval you're measuring (depending on what 'between' means) and find
the difference.  That should give you a close result down to the microsecond.