Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Witty Pi 4: how to synchronise time with Internet on boot?

3 Posts
2 Users
0 Likes
865 Views
(@admin)
Posts: 507
Member Admin
Topic starter
 

It is not recommended to do time synchronisation so frequently, and it is actually not necessary with rather accurate RTC on Witty Pi 4. We have seen many cases that the schedule script was interrupted due to incorrect time from the the Internet, that's why we removed the "synchronisation on boot” feature from Witty Pi 4’s software.

However if you want to, you may use the attached BASH script (please rename it to synTime.sh) to write network time to system and the RTC. You should put it into “wittypi” directory and run “chmod +x syncTime.sh” to make it executable.

If you want to put the "synchronisation on boot” back, you may specify this script in the beforeScript.sh file, or you may modify the daemon.sh file and put it in a place you like.

If you rely on the internet time, you can not put the ‘&’ at the end of command (for calling synchTime.sh) to make it unblocking. The syncTime.sh script needs to be blocking everything until the time is synchronised. However as you can see I put a “sleep 120” in the syncTime.sh file too, this has been proved to be needed in real use cases, you may reduce the waiting time if you are sure the system gets stable sooner.

Here you can also see our motivation to remove the "synchronisation on boot” feature: the synchronisation requires the whole system to get stable first, and that require rather long time, while it also needs to block the daemon.sh script so the schedule script running can use the time from the network. We will have to either accept the schedule script get executed with a delay (maybe 2 minutes), or we cut the waiting time but accept the possibility to get a wrong network time and mess up everything. It is really hard to implement a solution that ticks all the boxes.

 
Posted : 12/05/2023 6:11 pm
(@spknmmike)
Posts: 0
New Member
 

Do you advise removing the network time portion from startup / syncTime.sh on Witty Pi 3 Mini also? Perhaps triggering it more infrequently?

I'm running a Pi remotely that connects via cellular and solar.

 
Posted : 13/06/2023 8:09 pm
(@admin)
Posts: 507
Member Admin
Topic starter
 

The same applies to Witty Pi 3 (Mini) too.

 

Posted by: @spknmmike

Do you advise removing the network time portion from startup / syncTime.sh on Witty Pi 3 Mini also? Perhaps triggering it more infrequently?

I'm running a Pi remotely that connects via cellular and solar.

 

 
Posted : 14/06/2023 12:11 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.