TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: R.WIESER
from: CHRIS ELVIDGE
date: 2019-11-06 10:22:00
subject: Re: How to check if the c

On 05/11/2019 14:30, R.Wieser wrote:
> Jim,
>
>> but surely all you need to do is read the RTC and the linux system
>> time and compare them.
>
> Why ?   If I actually can read the RTC than all I need to do is write it
> into the Pi's clock and be done with it.

Well isn't that how a real computer works.

The startup scripts read the hardware clock (RTC) and set the system
time. (hwclock --hctosys)
When the network is up, ntpd is started to keep the system clock in
sync. (Or another clock radio, gps etc.)
On shutdown, the hardware clock is adjusted (if necessary) with the
current system time - assumed to be correct because of ntpd or similar
(hwclock --systohc).

You should disable the fake-hwclock (distributed with Raspbian and
derivatives) service and use the hwclock service.

>
> The thing is that the Pi can be given its time from a number of sources, and
> my approach is to ask the clock itself (where a single check should to),
> instead of trying to go thru all the possible sources.
>

Your approach is wrong if you have a real hardware clock - see above.

>> I see you think you have a "precise" realtime clock -
>> do you know how well it keeps time?
>
> Its a DS3231, which uses a temperature-controlled crystal to keep it as
> precise as possible.
>
> But its not the the Pi's clock drift that bothers me. Its that, without an
> internet connection and being shut down and rebooted (much) later, it could
> be running with yesterdays (or even before) date and time.
>
> .... Though I just realized that if the clock is saved on shutdown and
> reloaded when its boots again (as I seem to remember) the filetimes not
> being the actual time doesn't really interfere with being able to compare
> them.   But that doesn't mean that I would not rather have them reflect the
> actual time. :-)
>
> Regards,
> Rudy Wieser
>
>



--

Chris Elvidge, England

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.