rfmoz / tuptime

Report historical and statistical real time of the system, keeping it between restarts. Like uptime command but with more interesting output.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Negative downtime - how to correct?

nowindows opened this issue · comments

commented

tuptime version 3.3.1. On raspberry pi - Raspbian GNU/Linux 9 (stretch) tuptime gives:
System downtime: -0.0 % - -1 years, 364 days, 23 hours, 59 minutes and 52 seconds

Full tuptime output:
System startups: 6 since 11:40:24 10/03/19
System shutdowns: 5 ok - 0 bad
System uptime: 100.0 % - 13 days, 3 hours, 12 minutes and 5 seconds
System downtime: -0.0 % - -1 years, 364 days, 23 hours, 59 minutes and 52 seconds
System life: 13 days, 3 hours, 11 minutes and 58 seconds

Largest uptime: 5 days, 0 hours, 0 minutes and 0 seconds from 22:15:01 11/03/19
Shortest uptime: 1 hour, 7 minutes and 56 seconds from 11:40:24 10/03/19
Average uptime: 2 days, 4 hours, 32 minutes and 1 second

Largest downtime: -1 years, 364 days, 23 hours, 59 minutes and 58 seconds from 12:48:20 10/03/19
Shortest downtime: -1 years, 364 days, 23 hours, 59 minutes and 58 seconds from 12:48:20 10/03/19
Average downtime: -1 years, 364 days, 23 hours, 59 minutes and 58 seconds

Current uptime: 16 hours, 37 minutes and 22 seconds since 22:15:00 22/03/19

Hello Joe,

Raspberry Pi have a particular behaviour with the time reported at startup because it doesn't have internal clock. At that beginning momment, the time value depends on the installation. Please, check the section "About sync date and time" in the manual [1].

From other side, in the last releases, there are some improvements to avoid the negative downtime. Please, replace the executable file, it will work without problem:

sudo wget https://raw.githubusercontent.com/rfrail3/tuptime/master/src/tuptime -O /usr/bin/tuptime

Thanks,

[1] - https://github.com/rfrail3/tuptime/blob/master/tuptime-manual.txt

commented

Thanks Ricardo!

It seems the that the downtime problem was evident on the Pi 3B+ and not on the slower pi's.

The new executable fixed things on the Pi 3B+. Is there any way to fix the reported Shortest downtime?

System startups: 9 since 11:40:24 10/03/19
System shutdowns: 7 ok -> 1 bad
System uptime: 100.0 % - 15 days, 8 hours, 6 minutes and 24 seconds
System downtime: 0.0 % - 19 seconds
System life: 15 days, 8 hours, 6 minutes and 43 seconds

Largest uptime: 5 days, 0 hours, 0 minutes and 0 seconds from 22:15:01 11/03/19
Shortest uptime: 9 seconds from 19:43:36 25/03/19
Average uptime: 1 day, 16 hours, 54 minutes and 3 seconds

Largest downtime: 13 seconds from 19:43:45 25/03/19
Shortest downtime: -1 years, 364 days, 23 hours, 59 minutes and 58 seconds from 12:48:20 10/03/19
Average downtime: 2 seconds

Current uptime: 3 minutes and 9 seconds since 19:43:58 25/03/19

Setting the downtime values to 0 will solve the report issue. Please, create a backup of the db file and execute the sql query with the fix:

cp /var/lib/tuptime/tuptime.db /var/tmp/tuptime.db.backup

sqlite3 /var/lib/tuptime/tuptime.db 'update tuptime set downtime=0 where downtime < 0;'

Run again tuptime and check the values. Let me know :)

commented

Yes that solved the problem. 0 seconds for Shortest Downtime. Thanks!

commented

Very fast response by developer. Thank You!