Was just investigating a little issue with a long running (stuck)
process. I logged in at 9:20PM:

10002  0.0  0.0  3740  2420 ??  S      9:20PM    0:00.02 sshd

So you can imagine my surprise to see a cron job running in the future:

24292  0.0  0.0   776   616 ??  Is     9:25PM    0:08.51 /bin/sh

Check the date:
$ date
Tue Jul 22 21:22:00 EDT 2014

hrmmmm.... Finally, the date rolled over:
24292  0.0  0.0   776   616 ??  Is    Mon09PM    0:08.51 /bin/sh

Maybe I'm just easily confused, but I think 12 hours is sufficient
time for minute precision, then we can switch to day+hour. I thought
about other windows, like 20 hours, but figure 12 is reasonable for
"short lived" processes. Important thing, to me, is that we don't
print day old times that look like "now" or "soon".

Index: print.c
===================================================================
RCS file: /cvs/src/bin/ps/print.c,v
retrieving revision 1.57
diff -u -p -r1.57 print.c
--- print.c     4 Jul 2014 05:58:31 -0000       1.57
+++ print.c     23 Jul 2014 01:27:28 -0000
@@ -410,7 +410,7 @@ started(const struct kinfo_proc *kp, VAR
        tp = localtime(&startt);
        if (!now)
                (void)time(&now);
-       if (now - kp->p_ustart_sec < 24 * SECSPERHOUR) {
+       if (now - kp->p_ustart_sec < 12 * SECSPERHOUR) {
                (void)strftime(buf, sizeof(buf) - 1, "%l:%M%p", tp);
        } else if (now - kp->p_ustart_sec < 7 * SECSPERDAY) {
                (void)strftime(buf, sizeof(buf) - 1, "%a%I%p", tp);

Reply via email to