set tv_usec 0 in Linux
parent
b1a6bbfa27
commit
39b0a94eb2
|
|
@ -112,6 +112,7 @@ int get_boot_time(struct timeval *boot_time)
|
|||
gettimeofday(¤t_time, NULL);
|
||||
btime = TIMEVAL_TO_SECONDS(current_time) - uptime;
|
||||
SECONDS_TO_TIMEVAL(btime, *boot_time);
|
||||
boot_time->tv_usec = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -519,6 +520,7 @@ int get_processes(struct fast_process_info **processes, int *count)
|
|||
SECONDS_TO_TIMEVAL(TIMEVAL_TO_SECONDS(boot_time) +
|
||||
(double)starttime / (double)tickets,
|
||||
proc_array.procs[proc_array.count].starttime);
|
||||
proc_array.procs[proc_array.count].starttime.tv_usec = 0;
|
||||
|
||||
proc_array.count++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
stat("/etc/passwd", &st);
|
||||
printf("file inode: %ld\n", (long)st.st_ino);
|
||||
printf("file device: %"PRId64"\n", *((int64_t *)&st.st_dev));
|
||||
printf("file device: %ld\n", (long)st.st_dev);
|
||||
printf("file access time: %d.%ld\n", (int)st.st_atime, st.st_atimensec);
|
||||
printf("file modify time: %d.%ld\n", (int)st.st_mtime, st.st_mtimensec);
|
||||
printf("file change time: %d.%ld\n", (int)st.st_ctime, st.st_ctimensec);
|
||||
|
|
|
|||
Loading…
Reference in New Issue