#include <sys/times.h> clock_t times(struct tms *buf);
clock_t就是返回的ticks的值,在一般的linux定义中,它是long的typedef。
unsigned long ticks = (unsigned long) times( NULL );
ticks的时间精度,如下方法:
unsigned long HZ = sysconf( _SC_CLK_TCK );
它返回每秒中的ticks个数。
其中_SC_CLK_TCK在文件 unistd.h中定义。