Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 332753 - app-misc/uptimed-0.3.16-r4 has an error in up/downtime percentage reporting [PATCH]
Summary: app-misc/uptimed-0.3.16-r4 has an error in up/downtime percentage reporting [...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Raúl Porcel (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-14 16:14 UTC by Thomas
Modified: 2010-09-11 18:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix this display problem (percent_up_fix.patch,398 bytes, patch)
2010-08-14 16:15 UTC, Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas 2010-08-14 16:14:38 UTC
The "uprecords" utility displays your total uptime, downtime, and the percentage. As it is, though, the uptime is a positive number and the downtime a negative one, and the formula:
(float)totalutime / (float)(totalutime + totaldtime) * 100

... so if totalutime is 10000s, and totaldtime 100s, the result is
10000 / (10000 + -100) * 100 = 101.01%.

This patch changes totaldtime to a negative number before the calculation/display, giving me 99.3% uptime rather than >100%.

Reproducible: Always

Steps to Reproduce:
1. Use uptimed for a while.
2. Run "uprecords" and look at "up", "down" and "%up".
Actual Results:  
%up can be >100%.

Expected Results:  
Uptime is obviously never >100%.
Comment 1 Thomas 2010-08-14 16:15:20 UTC
Created attachment 242963 [details, diff]
Patch to fix this display problem
Comment 2 Raúl Porcel (RETIRED) gentoo-dev 2010-09-11 18:25:06 UTC
Report this upstream please.