Submitted By: Jim Gifford (patches at jg555 dot com) Date: 2003-09-13 Initial Package Version: 18 Origin: Rawhide Description: Better Uptime Calculations diff -Naur procinfo-18.orig/routines.c procinfo-18/routines.c --- procinfo-18.orig/routines.c 2001-02-24 23:30:45.000000000 +0000 +++ procinfo-18/routines.c 2003-09-13 07:33:12.000000000 +0000 @@ -390,19 +390,19 @@ unsigned int d, h, m, s; static char buf[22]; - t = t * 100 / HZ; - d = (int) (t / 8640000); - t = t - (long) (d * 8640000); - h = (int) (t / 360000); - t = t - (long) (h * 360000); - m = (int) (t / 6000); - t = t - (long) (m * 6000); - s = (int) (t / 100); - t = t - (long) (s * 100); + t *= (100 / HZ); + d = (unsigned int) (t / 8640000); + t -= (unsigned long) (d * 8640000); + h = (unsigned int) (t / 360000); + t -= (unsigned long) (h * 360000); + m = (unsigned int) (t / 6000); + t -= (unsigned long) (m * 6000); + s = (unsigned int) (t / 100); + t -= (unsigned long) (s * 100); if (d > 0) - sprintf (buf, "%3ud %2u:%02u:%02u.%02u", d, h, m, s, (int) t); + sprintf (buf, "%3ud %2u:%02u:%02u.%02u", d, h, m, s, (unsigned int) t); else - sprintf (buf, " %2u:%02u:%02u.%02u", h, m, s, (int) t); + sprintf (buf, " %2u:%02u:%02u.%02u", h, m, s, (unsigned int) t); return buf; }