结构体struct timeval 和 struct timespec的定义均在头文件<sys/time.h>中,具体定义如下:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
struct timespec {
long tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};