?? timer.c
字號:
/******************************************************************************
*
* Copyright (c) 2008 Shanghai IS Software
*
* All rights reserved
*
* $Revision$
*
* $LastChangedBy$
* 1.lcj
*
* $LastChangedData$
* 2008/09/26
*
* Description: Timer (10ms)
*
* Revision History:
* 2008/09/27 14:33 by lcj
* #1.created
*
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/select.h>
#include <errno.h>
void ms_sleep(unsigned long ms)
{
int err;
struct timeval tv;
tv.tv_sec = ms/1000;
tv.tv_usec = (ms%1000) * 1000;
while ((-1 == select(0,0,0,0,&tv)) && (err == errno));
}
void timer(int sec,long usec)
{
struct timeval tvselect;
tvselect.tv_sec = sec;
tvselect.tv_usec = usec;
select(0,NULL,NULL,NULL,&tvselect);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -