groundhogday
asked on
Need a milisecond timer
Does anyone know what function I can use beside clock() under Linux to track time interval? The CLOCKS_PER_SEC value is set to 1000000 and overflows quickly. I need to track at least 30 days but also need milisecond level. It would be nice if 1000000 can be changed to 1000. Thanks.
You do not have to maintain 2 varaibles since by using gettimeofday you get a struct that holds both the seconds and the microseconds, so you win 2 times - first you have got microsecond resolution, and second it lasts about 200-300 years...
Hope this helps,
Liron.
Hope this helps,
Liron.
ASKER
Can someone show sample code using gettimeofday to track time interval?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
slironm, Sorry, but I've been away for a while. Thanks for the help.
Gary