timer.c

来自「一个反向传播算法的的原程序!值得一看」· C语言 代码 · 共 30 行

C
30
字号
/*
*-----------------------------------------------------------------------------
*	file:	timer.c
*	desc:	time a program in secs
*	by:	patrick ko
*	date:	18 jan 92
*-----------------------------------------------------------------------------
*/

#include <stdio.h>
#include <time.h>

static time_t	last;
static time_t	this;
static time_t	temp;

void timer_restart( )
{
	time( &last );
}

long int timer_stop( )
{
	time( &this );
	temp = this - last;
	last = this;

	return ((long int)temp);
}

⌨️ 快捷键说明

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