top lies about system uptime
Brought to you by:
wnl
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.
Patch to make top uptime reporting accurate