/usr/include/sys/time.h
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv, const struct timezone *tz);
C/C++ code?
#include <sys/time.h>
#include <unistd.h>
int main()
{
struct timeval tv;
struct timezone tz;
/* 获取 */
gettimeofday(&tv, &tz);
printf("tv_sec: %d\n", tv.tv_sec);
printf("tv_usec: %d\n", tv.tv_usec);
/* 设置 */
/*
//类似,结合 man 手册***
*/
}