I have a project that consists of several containers. I would like it to connect to the GNSS receiver each time the system is started, hostOS or any container, and based on that, update the raspberry pi time to the current GPS time. It then freed the GNSS receiver for further use and the updated time was available to all containers together.
hi, there is currently no support in balenaOS to use a GPS device as a time source. I would recommend you to upvote a feature request for this so that it’s taken into consideration by our product team.
However, there are some workarounds we can propose.
You can have a container that stops the hostOS chrony using d-bus, and runs its own chrony which is then configured to use a GPS source and can update the system time, similar to GitHub - nmaas87/gpsTime: balena enabled GPS NTP timeserver
Alternatively, you could run a container that uses the GPS source to correct the system time, but this has to be done carefully and in small increments.
Also, I would consider using an RTC device to keep time if possible.