?? alarm.c
字號:
/* vi: set sw=4 ts=4: *//* * alarm() for uClibc * * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org> * * GNU Library General Public License (LGPL) version 2 or later. */#include "syscalls.h"#include <unistd.h>#ifdef __NR_alarm_syscall1(unsigned int, alarm, unsigned int, seconds);#else#include <sys/time.h>unsigned int alarm(unsigned int seconds){ struct itimerval old, new; unsigned int retval; new.it_value.tv_usec = 0; new.it_interval.tv_sec = 0; new.it_interval.tv_usec = 0; new.it_value.tv_sec = (long int) seconds; if (setitimer(ITIMER_REAL, &new, &old) < 0) { return 0; } retval = old.it_value.tv_sec; if (old.it_value.tv_usec) { ++retval; } return retval;}#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -