vietpa
asked on
Calculate the time different in milisecond or microsecond
I like to do the job above and i know time_t, unfortunately, in only result in second, and gettickcount() is for windows.
Anyone has the solution to do in Linux. Thanks in advance.
Anyone has the solution to do in Linux. Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Infinity08: it seems works, may be the time different is to small, how to increase to microsec ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the standard clock() which will return the number of elapsed clock ticks :
http://www.cplusplus.com/reference/clibrary/ctime/clock.html
Its granularity is generally a few milliseconds though. You can use the value CLOCKS_PER_SEC to know its granularity.