Hello Chris!
Thursday February 10 2022 21:07, you wrote to All:
Are you SURE that it is not installed ?
Vincent
Hello Chris!
Thursday February 10 2022 21:07, you wrote to All:
Are you SURE that it is not installed ?
Vincent
Re: How does Pi get its time? By: Chris Green to All on Thu Feb 10 2022 09:07 pm
CG> How do Raspberry Pis know what the time is?
CG> On my Pis NTP isn't installed but they seem to know what the time is CG> OK so how do they do it?
If you are running Raspbian, it could well be timesyncd.
Tristan.
Hello Dennis!
Thursday February 10 2022 18:11, you wrote to All:
No it is not new I have been using distro Mageia for many years which uses it.
More of a pain is the universal journal usage which need the usage of journalctl to extract what you need to look at although there is a process to remove that need for specific logs.
Just a pain to try and remember the process :(
Vincent
How do Raspberry Pis know what the time is?
On my Pis NTP isn't installed but they seem to know what the time is OK so how do they do it?
systemd.timesync.d
too many .
systemd.timesyncd
Depends what OS you've got. I'm assuming it is Raspberry Pi OS.
As far as I know systemd provides an NTP client - systemd-timesyncd
Try the command
systemctl status systemd-timesyncd
might need a sudo in front.
Does it run ntpdate at boot ?
Beware of running time-sensitive software on a Pi that reboots and doesn't immediately have an internet connection.
I use a Pi to run Cumulus weather station software. This logs and graphs data from a weather station. If there has been a power cut, everything
*starts* to boot at the same time when the power comes back. If the Pi boots first, and the router takes its time connecting, the Pi will run with a silly time until it is able to synchronise with an internet time source. This leads to graphs which suddenly shoot back by several hours (when the Pi reboots) and then shoot forward again (once the Pi has managed to synchronise). My impression is that the Pi checks frequently for a time source to begin with, which is why I rarely see the problem, but then starts polling less frequently, which is why on the rare occasions that I've seen the problem, the update to the correct time happens a fair time after the router has connected and I've been able to browse the web on other computers. The Pi seems to have a crude real-time clock which gets the time approximately right (maybe wrong by a couple of hours), rather than reverting to "the beginning of time" (1 Jan 1970).It's not the end of the world, and not worth the hassle of implementing a proper battery-backed RTC (as on a Windows/Linux PC). The software logs readings every 10 minutes (though it graphs them every minute) so there aren't usually many readings that have an incorrect timestamp, and it's obvious which times are missing because they *should* be at 00, 10, 20, 30,
40, 50 minutes past every hour. It's just a case of hand-editing the log file and then restarting the software manually so it regenerates the graphs with the correct time axis.I imagine that a Pi that is run without an internet connection (eg an unattended device with no Ethernet/wifi connection) will free-run - unless it has a GPS connection (eg to record a track of where it is going) in which case it can be configured to use the time from the GPS to sync the system clock. I imagine there are RTC modules that communicate through the GPIO socket, for devices that have no internet connection.
Well I can't see anything that looks like it:-
chris@backup$ ps -ef | grep -i ntp chris 7885 7820 0 22:36 pts/0 00:00:00 grep --color=auto -i ntp chris@backup$ man -k ntp grantpt (3) - grant access to the slave pseudoterminal intptr_t (3) - overview of system data types mountpoint (1) - see if a directory or file is a mountpoint ntp_adjtime (3) - tune kernel clock ntp_gettime (3) - get time parameters (NTP daemon interface) ntp_gettimex (3) - get time parameters (NTP daemon interface) uintptr_t (3) - overview of system data types
Ah, thank you. Why did they have to change the name from the almost universal ntp I wonder.
On Thu, 10 Feb 2022 22:38:16 +0000, Chris Green snipped-for-privacy@isbd.net declaimed the following:
For the same reason the fairly easily understood Sys-V init processing is being replaced by the mysterious complicated systemd scheme... "It's new! Therefore it must be better!"
You can look at the running systemd units by doing something like `systemctl list-units` and see if systemd is running the time syncing. If it's Raspbian, it's probably running through systemd.
It has no hardware clock; in a controlled shutdown or reboot it saves the last known time to disk and reads that when it starts up again, starts counting from there. So it will be behind by how ever long it was down; maybe 15-20 seconds for a reboot? The same happens in the case of sudden power failure, but I'm not sure how often it saves the current datetime value during normal operation, so that may be why in that case it is behind by more.
No sudo needed. Strange output on my Pi: says it has been running since ~2 minutes ago (that's about when I logged in) but this Pi is always on and 'uptime' says I last rebooted 2 days ago.
On Fri, 11 Feb 2022 01:11:40 +1200, snipped-for-privacy@f1.n.z2.fidonet.org (Vincent Coen) declaimed the following:
I'd have made the same complaint then... As the precursor Mandrake Linux was sys-v init based...
On a sunny day (Thu, 10 Feb 2022 21:07:55 +0000) it happened Chris Green snipped-for-privacy@isbd.net wrote in snipped-for-privacy@esprimo.zbmc.eu>:
On one of my raspberries I have a GPS module connected to /dev/ttyAMA0 it gets location and time even if there is no net connection.
On my Raspberry Pi cards I always install NTP. As you say, sadly this isn't the default on recent OS versions, so an extra step is required.
As often with Linux, the approach /appears/ to be "If it works, change it!".
You can get a board with a GPS and RTC here:
And presumably you also uninstall the alternative systemd-timesyncd? I
*hate* the complexity of systemd vs the old sysvinit, but time sync is one service that just works in the background, so I don't bother with it & am not bothered by it. What are the specific advantages of ntp for you?Have something to add? Share your thoughts — no account required.
Ask the community — no account required