Ted Unangst wrote:
> Philip Guenther wrote:
> > I think it would be better to include the clock_t value in the
> > timespec struct tracing, then branch on that.
>
> I of course looked at that, but it's a lot of plumbing...
If there is no serious objection, I'd like to go ahead with this version,
which increases the span. This won't complicate future improvements.
I'll note that this is a pretty printer and such heuristics are common.
Both ls -l and ps a will print dates in a variety of formats based on their
value.
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 19:08:21 -0000
@@ -147,7 +147,8 @@ print_time(time_t t, int relative, int h
} else
printf("%jd", (intmax_t)t);
- if (!relative) {
+ /* 1970s times are probably relative */
+ if (!relative && t > (10 * 365 * 24 * 3600)) {
tm = localtime(&t);
if (tm != NULL) {
(void)strftime(timestr, sizeof(timestr), TIME_FORMAT,