You can use getnstimeofday
for that.
/* getnstimeofday - Returns the time of day in a timespec */
void getnstimeofday(struct timespec *ts)
where struct timespec
is:
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
And yes, you'll need #include <linux/time.h>
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…