Updating the GPS time from one container and making it available to all containers.

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.

Do you have any ideas?

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.

  1. 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
  2. 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.