timer.c

来自「超前校正环节,低界控制系统的超前控制算法,简单实用,MATLAB实现.」· 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 + -
显示快捷键?