diff --git a/SOURCES/procps-ng-3.3.15-uptime-pretty-mod.patch b/SOURCES/procps-ng-3.3.15-uptime-pretty-mod.patch new file mode 100644 index 0000000..c3799b9 --- /dev/null +++ b/SOURCES/procps-ng-3.3.15-uptime-pretty-mod.patch @@ -0,0 +1,40 @@ +From 7eade2544e1c45bc516744aeaccc45df1d8f42df Mon Sep 17 00:00:00 2001 +From: Kyle Walker +Date: Tue, 11 Feb 2020 14:30:39 -0500 +Subject: [PATCH] whattime: Refactor the pretty-print evaluation + +This avoids rounding errors such as in the case of 364 days of uptime which +results in only output that prints at the hour and below. +--- + proc/whattime.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/proc/whattime.c b/proc/whattime.c +index c223cad..3e1b65c 100644 +--- a/proc/whattime.c ++++ b/proc/whattime.c +@@ -69,9 +69,18 @@ char *sprint_uptime(int human_readable) { + + if (human_readable) { + updecades = (int) uptime_secs / (60*60*24*365*10); +- upyears = ((int) uptime_secs / (60*60*24*365)) % 10; +- upweeks = ((int) uptime_secs / (60*60*24*7)) % 52; +- updays = ((int) uptime_secs / (60*60*24)) % 7; ++ if (updecades) ++ uptime_secs -= updecades * (60*60*24*365*10); ++ ++ upyears = (int) uptime_secs / (60*60*24*365); ++ if (upyears) ++ uptime_secs -= upyears * (60*60*24*365); ++ ++ upweeks = (int) uptime_secs / (60*60*24*7); ++ if (upweeks) ++ uptime_secs -= upweeks * (60*60*24*7); ++ ++ updays = (int) uptime_secs / (60*60*24); + } + else + updays = (int) uptime_secs / (60*60*24); +-- +2.24.1 + diff --git a/SPECS/procps-ng.spec b/SPECS/procps-ng.spec index 84dd9f7..189cb30 100644 --- a/SPECS/procps-ng.spec +++ b/SPECS/procps-ng.spec @@ -4,7 +4,7 @@ Summary: System and process monitoring utilities Name: procps-ng Version: 3.3.15 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ Group: Applications/System URL: https://sourceforge.net/projects/procps-ng/ @@ -21,6 +21,7 @@ Patch2: procps-ng-3.3.15-pgrep-uid-conversion-overflow.patch Patch3: procps-ng-3.3.15-vmstat-watch-manpage.patch Patch4: procps-ng-3.3.15-pidof-kernel-workers-option.patch Patch5: procps-ng-3.3.15-pidof-separator-option-backport.patch +Patch6: procps-ng-3.3.15-uptime-pretty-mod.patch BuildRequires: ncurses-devel BuildRequires: libtool @@ -163,6 +164,10 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %files i18n -f %{name}.lang %changelog +* Wed Mar 23 2022 Jan Rybar - 3.3.15-7 +- uptime: human readable data not shown if 364 days up +- Resolves: rhbz#1772999 + * Tue Dec 01 2020 Jan Rybar - 3.3.15-6 - pidof: option for separator collides with other option - Resolves: rhbz#1895985