先看下列的例子程序
#include <sys/time.h>#include <sys/select.h>#include <unistd.h>#include <assert.h>
#define STDIN 0#define TRUE 1#define FALSE 0#define ulong unsigned long
static struct timeval timeLast;static volatile char TmoutEnable;
void timeEnable(){ int res = gettimeofday( &timeLast, NULL );//获取当前时间计数
assert( res == 0 ); TmoutEnable = TRUE;}
void timerECE( )//毫秒定时器{ ulong ulDeltaMS; struct timeval timeCur;//当前时间
if......
阅读全文