diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:30 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:30 +0200 |
commit | e2b58f0ab81b2aafeb8c29a69abad7829fa21ab3 (patch) | |
tree | c4e410dd878ceed9fc058d14bad8011b423212fe /Process.c | |
parent | eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95 (diff) | |
download | debian_htop-e2b58f0ab81b2aafeb8c29a69abad7829fa21ab3.tar.gz debian_htop-e2b58f0ab81b2aafeb8c29a69abad7829fa21ab3.tar.bz2 debian_htop-e2b58f0ab81b2aafeb8c29a69abad7829fa21ab3.zip |
Imported Upstream version 1.0.1upstream/1.0.1
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -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 <stdio.h> #include <sys/time.h> #include <sys/resource.h> #include <sys/param.h> -#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <stdlib.h> #include <signal.h> #include <string.h> #include <stdbool.h> #include <pwd.h> #include <sched.h> #include <time.h> +#include <assert.h> #ifdef HAVE_LIBHWLOC #include <hwloc/linux.h> @@ -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 <sys/types.h> #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) { |