?? sleep.c
字號:
#include <unistd.h>#include <time.h>#include <sys/select.h>unsignedsleep(unsigned nsec){ int n; unsigned slept; time_t start, end; struct timeval tv; tv.tv_sec = nsec; tv.tv_usec = 0; time(&start); n = select(0, NULL, NULL, NULL, &tv); if (n == 0) return(0); time(&end); slept = end - start; if (slept >= nsec) return(0); return(nsec - slept);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -