ticks.h

来自「Data Structures with C++附代码」· C头文件 代码 · 共 29 行

H
29
字号
#ifndef TICK_COUNT
#define TICK_COUNT

#ifdef __GNUC__
#include <sys/types.h>
#include <sys/times.h>

long TickCount(void)
{
	struct tms accumTime;

	times(&accumTime);
	return accumTime.tms_utime + accumTime.tms_stime;
}
#endif  // __GNUC__

#ifdef __BORLANDC__

#include <time.h>

long TickCount(void)
{
	return (clock()/CLK_TCK)*60;
}

#endif  // __BORLANDC__

#endif  // TICK_COUNT

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?