13

I've a raspberry Pi that I was using in EST timezone. It had ntp service installed (sudo apt-get install ntp) and the Pi was set to UTC timezone. The date on the Pi was correct, until I took the Pi to Pacific Timezone. When I booted the PI, the UTC time on the Pi is way off (behind by 9 hours), and ntp just doesn't sync to get the correct UTC time. The Pi is connected to the internet via ethernet.

I've tried rebooting the Pi several times. Also, I've tried removing ntp and installing openntp. Any suggestions on what could be going on?

I'm using Pi3 with Raspbian Jessie.

17

Here are some suggestions.

  1. Use the raspi-config utility to reset the timezone even if already you used a different tool to set it.

    sudo raspi-config
    
  2. Manually set the time to be somewhat accurate. NTP sometimes won't update if the time/date is wildly wrong.

    sudo date -s "01/04/2017 11:00"
    
  3. Manually force time update:

    sudo systemctl stop ntp.service
    sudo ntpd -gqc /etc/ntpd.conf
    sudo systemctl start ntp.service
    
  4. Make sure you aren't blocking UDP port 123.

Best of luck!

6

In many Linux systems, the clock keeps track of time in UTC. Because of the Raspberry Pi's poor time-keeping, it's smart to install and properly setup a service to help with time, such as ntp.

This is further complicated by the fact that the Raspberry Pi has no way of keeping time while off/without power. This means when the Raspberry Pi restarts, its time will de-sync.

When you use commands such as date, which query for time, they take your locale into account. This means that date will use the timezone offset from your locale to determine local time. When you type date, you will see which timezone is being displayed:

date
Wed Jan  4 11:01:44 PST 2017

If you don't have your locale set properly, or use the -u flag, you will see:

date -u
Wed Jan  4 19:01:45 UTC 2017

When you are comparing the time and say that it's off by 6 hours, are you comparing UTC time to current UTC time, or are you comparing UTC time to the time in your timezone?

When you type date, are you shown the proper timezone? If not, you should set that up:

sudo dpkg-reconfigure tzdata # Select timezone
1

I solved this issue by setting the time manually using timedatectl, like so:

sudo timedatectl set-time 'yyyy-mm-dd hh-mm'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.