Small timespecs print funny:

 57686 chrome   CALL  clock_gettime(CLOCK_MONOTONIC,0x7f7fffff0028)
 57686 chrome   STRU  struct timespec { 15411<"Dec 31 23:16:51 1969">.584609082 
}
 57686 chrome   RET   clock_gettime 0
 57686 chrome   CALL  clock_gettime(CLOCK_MONOTONIC,0x7f7ffffeff48)
 57686 chrome   STRU  struct timespec { 15411<"Dec 31 23:16:51 1969">.584623819 
}
 57686 chrome   RET   clock_gettime 0

Here's a simple heuristic which makes this output a little easier to read,
without the meaningless 1969 dates.

 57686 chrome   CALL  clock_gettime(CLOCK_MONOTONIC,0x7f7fffff0028)
 57686 chrome   STRU  struct timespec { 15411.584609082 }
 57686 chrome   RET   clock_gettime 0
 57686 chrome   CALL  clock_gettime(CLOCK_MONOTONIC,0x7f7ffffeff48)
 57686 chrome   STRU  struct timespec { 15411.584623819 }
 57686 chrome   RET   clock_gettime 0


Index: ktrstruct.c
===================================================================
RCS file: /cvs/src/usr.bin/kdump/ktrstruct.c,v
retrieving revision 1.19
diff -u -p -r1.19 ktrstruct.c
--- ktrstruct.c 22 May 2016 23:02:28 -0000      1.19
+++ ktrstruct.c 1 Jun 2016 01:41:59 -0000
@@ -147,7 +147,8 @@ print_time(time_t t, int relative, int h
        } else
                printf("%jd", (intmax_t)t);
 
-       if (!relative) {
+       /* small timespecs are probably relative */
+       if (!relative && t > 86400) {
                tm = localtime(&t);
                if (tm != NULL) {
                        (void)strftime(timestr, sizeof(timestr), TIME_FORMAT,

Reply via email to