I have a Raspberry Pi that has no access to internet. It is configured as an access point that I can connect to using my smartphone or tablet. Time on the Raspberry Pi is never correct after booting and I want it to automatically sync with the first device that connect to it. Those android devices (smartphone or tablet) will also have no internet access but their time will be correct. Is that possible?

I use the Raspberry Pi to control my telescope mount in a remote area hence the absence of internet. The tablet is just used as a VNC client displaying the Raspi's desktop.

  • "hotspot" with no Internet? Please explain what you mean by hotspot. Have you considered using a GPS as time source?
    – Seamus
    Sep 28, 2020 at 15:38
  • @Seamus I changed hotspot to "access point" if that is clearer
    – Mehdi
    Sep 28, 2020 at 15:40
  • 1
    Ah - OK... I assume the requirement for accurate time on the Pi is that it's used to position your telescope somehow. Are you aware of how the RPi maintains its time? So the fundamental problem for RPi timekeeping is that it has no Real Time Clock. Your phones probably do, but a transfer from Android to RPi won't last long. Have you considered a GPS unit for getting accurate time to your PI?
    – Seamus
    Sep 28, 2020 at 15:50
  • Unless you are aware or can find or create a means to get the information from the phone -- by which I mean, something a connected device can do that the phone will respond to and provide the time, there's nothing to try. There may be something in the DHCP negotiation, although IP packets in and of themselves aren't timestamped. If so, you could probably hook into something using dhcpcd (see man dhcpcd-run-hooks). Beyond that, network programming for something like this is pretty simple on the Pi, but more complicated on Android.
    – goldilocks
    Sep 28, 2020 at 16:27
  • I did a quick search for "NTP server Android" but did not find anything, most of the stuff is of course about how to connect to one. You could try asking somewhere like android.stackexchange.com -- you want an NTP server to that will work on a hotspot while the phone is otherwise off-line. I think Seamus's suggestion is the most robust (and probably easiest unless you find a pre-existing app for this): GPS information includes the time, does not require much power, and works pretty much anywhere on Earth above ground at this point, I think.
    – goldilocks
    Sep 28, 2020 at 16:29


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.