From e2b58f0ab81b2aafeb8c29a69abad7829fa21ab3 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:30 +0200 Subject: Imported Upstream version 1.0.1 --- Process.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'Process.c') diff --git a/Process.c b/Process.c index fec3f33..1ae96e1 100644 --- a/Process.c +++ b/Process.c @@ -5,29 +5,27 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ +#include "Process.h" + #include "ProcessList.h" -#include "Object.h" #include "CRT.h" #include "String.h" -#include "Process.h" #include "RichString.h" -#include "Affinity.h" - -#include "debug.h" #include #include #include #include -#include #include #include +#include #include #include #include #include #include #include +#include #ifdef HAVE_LIBHWLOC #include @@ -41,6 +39,9 @@ in the source distribution for its full text. #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) /*{ +#include "Object.h" +#include "Affinity.h" +#include #ifndef Process_isKernelThread #define Process_isKernelThread(_process) (_process->pgrp == 0) @@ -312,19 +313,24 @@ static void Process_printTime(RichString* str, unsigned long long t) { double realTime = t * jiffytime; int iRealTime = (int) realTime; - int hours = iRealTime / 3600; + unsigned long long hours = iRealTime / 3600; int minutes = (iRealTime / 60) % 60; int seconds = iRealTime % 60; int hundredths = (realTime - iRealTime) * 100; char buffer[11]; - if (hours) { - snprintf(buffer, 10, "%2dh", hours); + if (hours >= 100) { + snprintf(buffer, 10, "%7lluh ", hours); RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); - snprintf(buffer, 10, "%02d:%02d ", minutes, seconds); } else { - snprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths); + if (hours) { + snprintf(buffer, 10, "%2lluh", hours); + RichString_append(str, CRT_colors[LARGE_NUMBER], buffer); + snprintf(buffer, 10, "%02d:%02d ", minutes, seconds); + } else { + snprintf(buffer, 10, "%2d:%02d.%02d ", minutes, seconds, hundredths); + } + RichString_append(str, CRT_colors[DEFAULT_COLOR], buffer); } - RichString_append(str, CRT_colors[DEFAULT_COLOR], buffer); } static inline void Process_writeCommand(Process* this, int attr, int baseattr, RichString* str) { -- cgit v1.2.3