在linux下获取从启动到当前的ticks数 right_line.gif 本文转自: http://blog.csdn.net/hello_wyq/archive/2006/08/14/1061659.aspx

#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中定义。

原文地址 http://blog.csdn.net/hello_wyq/archive/2006/08/14/1061659.aspx