Monday, March 13, 2017

Raspberry pi wont update time on NTP

Weird problem with a pi zero-w, where when I put it on my friend's network it gets the wrong time.


Bit of a workaround, rather than a fix, but it got me up and running, and should be reliable...

  1. Open rc.local file
    sudo nano /etc/rc.local
  2. add following line to the rc.local file
    sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
  3. reboot the Rpi
    sudo reboot
Basically, it gets the HTTP headers from the server at google.com and sets the pi's time to that.




From:
https://raspberrypi.stackexchange.com/questions/47542/raspberry-pi-wont-update-time

No comments: