Uptime wrong

My Pi Zero (Raspbian, st v0.14.36) is now showing an uptime of 19h 32m. This about 19h 20m too high as I’ve just switched it on.

cpu 1,2%, No traffic. 19h + uptime survives screen refresh.

Seem to remember something like this happening before (>1 day out).

Is there any info I can gather?

The clock on the pi and the machine accessing the UI might be out of sync.

david@pi:~$ date Thu 17 Aug 10:05:18 BST 2017 david@monocerus:~$ date Thu 17 Aug 10:05:20 BST 2017

Sorry, wrong pi.

david@pie:~$ date

Thu 17 Aug 10:13:07 BST 2017

david@monocerus:~$ date

Thu 17 Aug 10:13:07 BST 2017

Maybe Syncthing started at boot and the clock was wrong, then later corrected by NTP.

… so, restarting st should fix the problem.

It did.

The pi doesn’t have an RTC. It saves the time at shutdown, restores it at boot and corrects it via NTP when it can.

The time difference could well be the time it was off.

Good spot @calmh.

:anguished: Yeah that’s the most likely explanation then.

A small chunk of journal to prove it.

Aug 16 14:09:45 pie nice[455]: [B3IQ5] INFO: Ready to synchronize "zzPpictures" (ayfes-crvzx) (readwrite)
Aug 16 14:09:46 pie systemd-timesyncd[291]: Using NTP server 193.150.34.2:123 (2.debian.pool.ntp.org).
Aug 17 09:17:03 pie systemd-timesyncd[291]: interval/delta/delay/jitter/drift 32s/+68836.893s/0.058s/0.000s/+0ppm
Aug 17 09:17:03 pie systemd[1]: Time has been changed
Aug 17 09:17:05 pie syncthing-inotify[456]: [WARNING] Cannot connect to Syncthing: Get http://127.0.0.1:8384/rest/4
Aug 17 09:17:05 pie syncthing-inotify[456]: 2017/08/17 09:17:05 Failed to perform request /rest/system/config:  Get

Also, this morning

Aug 16 14:09:09 pie kernel: Booting Linux on physical CPU 0x0

As much as I like the Pi in principle I’m amazed that they would omit a 50 cent chip that is present in like every other piece of electronics in the world and enables something as basic as (mostly) proper timekeeping. Ah well.

It’s not just the chip, it’s also the battery, and 50c is a substantial proportion of the cost of a Pi.

UK Pi Zero WW @ 9.60 GBP (10.55 EUR)

You can buy RTCs for the Pi (https://thepihut.com/pages/search-results?q=rtc), but the cost approaches that of the Pi itself.

Given access to an NTP server, the Pi keeps remarkably good time.

Saving the tiime at shutdown helps prevent time going backwards an the impact on file timestamps.

There’s just that hiccup at boot.

1 Like

Fair 'nuff :slight_smile:

1 Like

I tried to sort out something with systemd dependencies to get st to start a bit later, preferably after “clock” had been synced, without any success.

I’ve settled for a nasty frig

ExecStart=/bin/bash -c "/bin/sleep 60;/usr/bin/nice /usr/bin/syncthing -no-browser -no-restart -logflags=0
and
ExecStart=/bin/bash -c "/bin/sleep 120;/usr/bin/syncthing-inotify -logflags=0"

This seems to be good enough for now, but I’d like to do it better.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.