#51 top lies about system uptime

v3.8beta
open
nobody
Display (18)
5
2010-06-17
2010-06-17
J Snabb
No

The uptime reporting code in display.c i_uptime() function includes a line "uptime += 30;".

That line is required if the uptime is reported with a one minute accuracy (rounding up to the next minute in case half of the minute has passed) as common UNIX w(1) and uptime(1) commands do. Top however always reports the uptime with one second accuracy. Therefore the reported uptime is always 30 seconds longer than it should be. The code has been probably blindly copied from BSD w.c or similar.

The attached patch fixes that problem.

Discussion

  • J Snabb
    J Snabb
    2010-06-17

    Patch to make top uptime reporting accurate

     
    Attachments