www.pudn.com > streamrtp.rar > clock_gettime.c
/*------------------------------------------------------------------------- * clock_gettime.c - clock_gettime *------------------------------------------------------------------------- */ #ifdef LINUX #include#include #include /*----------------------------------------------------------------------- * clock_gettime - simulate POSIX call clock_gettime using gettimeofday. * clock_gettime is not supported under LINUX 2.2.12-20. *----------------------------------------------------------------------- */ int clock_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 */