📄 clock_gettime.c
字号:
/*------------------------------------------------------------------------- * clock_gettime.c - clock_gettime *------------------------------------------------------------------------- */#ifdef LINUX#include <errno.h>#include <sys/time.h>#include <util.h>/*----------------------------------------------------------------------- * clock_gettime - simulate POSIX call clock_gettime using gettimeofday. * clock_gettime is not supported under LINUX 2.2.12-20. *----------------------------------------------------------------------- */intclock_gettime(clockid_t clock_id, struct timespec *ts){ struct timeval tv; if (clock_id != CLOCK_REALTIME) { errno = EINVAL; return -1; } if (gettimeofday(&tv, NULL) < 0) { return -1; } TIMEVAL_TO_TIMESPEC(&tv, ts); return 0;}#endif /* LINUX */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -