X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Flibcfs%2Flinux%2Flinux-tracefile.c;h=6e08612044541c9cf9641d25dcf75e19ae15cbd7;hp=38edb50774c242c806bc40a68e947d92242af384;hb=a05ff6f7a0377bb1c2f9b1699f9b08ae9e981e1e;hpb=0c06af45b0c49955a5928eb92f13621919a223d0 diff --git a/libcfs/libcfs/linux/linux-tracefile.c b/libcfs/libcfs/linux/linux-tracefile.c index 38edb50..6e08612 100644 --- a/libcfs/libcfs/linux/linux-tracefile.c +++ b/libcfs/libcfs/linux/linux-tracefile.c @@ -188,16 +188,19 @@ cfs_set_ptldebug_header(struct ptldebug_header *header, struct libcfs_debug_msg_data *msgdata, unsigned long stack) { - struct timeval tv; + struct timespec64 ts; - do_gettimeofday(&tv); + ktime_get_real_ts64(&ts); header->ph_subsys = msgdata->msg_subsys; header->ph_mask = msgdata->msg_mask; header->ph_cpu_id = smp_processor_id(); header->ph_type = cfs_trace_buf_idx_get(); - header->ph_sec = (__u32)tv.tv_sec; - header->ph_usec = tv.tv_usec; + /* y2038 safe since all user space treats this as unsigned, but + * will overflow in 2106 + */ + header->ph_sec = (u32)ts.tv_sec; + header->ph_usec = ts.tv_nsec / NSEC_PER_USEC; header->ph_stack = stack; header->ph_pid = current->pid; header->ph_line_num = msgdata->msg_line;