TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: R.WIESER
from: TAUNO VOIPIO
date: 2019-11-05 18:43:00
subject: Re: How to check if the c

On 5.11.19 16: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.
>
> 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.
>
>> 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


You do need a piece of C code, run as root or suid root, reading the
external hardware clock and setting the internal one with a simple
system call.

Your problem is that the setting of system time needs root privileges.

--

-TV

--- 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™.