summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-11-07 19:17:42 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-11-07 19:17:42 +0000
commit9002c5d8d5a402a5441440f73d69c2f002882f0b (patch)
treea9586c0e93aa03287a4e33f1ae76da7fdc7a103a
parent42ed9dd33f265d7978e2346bcb8dafc2ef759195 (diff)
entered into RCS
-rw-r--r--utils/old-ps.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/utils/old-ps.c b/utils/old-ps.c
index d6114ed3..42185e58 100644
--- a/utils/old-ps.c
+++ b/utils/old-ps.c
@@ -51,10 +51,19 @@ char *
time_str (time_value_t *t)
{
char *ret = malloc (20);
- int time;
+ int centiseconds;
+
+ if (t->microseconds >= 1000000)
+ {
+ t->seconds += t->microseconds / 1000000;
+ t->microseconds %= 1000000;
+ }
+ centiseconds = t->microseconds / (1000000 / 100);
- time = t->seconds * 1000000 + t->microseconds;
- sprintf (ret, "%.2f", (double)time / 1000000.0 );
+ sprintf (ret, "%d:%2d.%2d",
+ t->seconds / 60, /* minutes */
+ t->seconds % 60, /* seconds */
+ centiseconds);
return ret;
}
@@ -79,7 +88,6 @@ print_args_str (process_t proc, pid_t pid)
vm_deallocate (mach_task_self (), (vm_address_t) args, nargs);
}
-
/* Very simple PS */
int
main ()