From 6dcfa92ee8119665c7e188e6e89160825ce351aa Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 24 May 2009 15:32:34 +0000 Subject: [PATCH] Fix elapsed (etime) field for swapped out processes in ps: show '-' instead of time since the Epoch. PR: bin/123069 Submitted by: Vladimir Kozbin Approved by: ed (mentor) MFC after: 3 weeks --- bin/ps/print.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/ps/print.c b/bin/ps/print.c index 1bfce04489e8..aa4f98f2c7bc 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -596,6 +596,10 @@ elapsed(KINFO *k, VARENT *ve) char obuff[128]; v = ve->var; + if (!k->ki_valid) { + (void)printf("%-*s", v->width, "-"); + return; + } val = now - k->ki_p->ki_start.tv_sec; days = val / (24 * 60 * 60); val %= 24 * 60 * 60;