diff --git a/procps-ng.spec b/procps-ng.spec index 0f1e034..46d8c47 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -4,7 +4,7 @@ Summary: System and process monitoring utilities Name: procps-ng Version: 3.3.17 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ URL: https://sourceforge.net/projects/procps-ng/ @@ -17,6 +17,7 @@ Source2: README.top Patch1: pwait-to-pidwait.patch Patch2: covscan_findings.patch +Patch3: uptime-pretty-mod.patch BuildRequires: make @@ -160,6 +161,10 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %files i18n -f %{name}.lang %changelog +* Fri Mar 25 2022 Jan Rybar - 3.3.17-5 +- uptime: human readable data not shown if 364 days up +- Resolves: rhbz#2067166 + * Tue Aug 10 2021 Mohan Boddu - 3.3.17-4 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 diff --git a/uptime-pretty-mod.patch b/uptime-pretty-mod.patch new file mode 100644 index 0000000..c3799b9 --- /dev/null +++ b/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 +