Monday, December 14, 2015

Configure the date and time of Raspberry Pi

Configure the timezone

1. Type this command:
sudo raspi-config

2. Select:
4. Internationalisation Options


3. Select:
I2 Change Timezone


4. Select Geographic area.

5. Select Timezone.

6. Select Finish.

The other method to change the timezone is to use the tzselect command.

Update the current time

1. Type this command:
sudo apt-get install ntpdate



2. Connect to the clock server with this:
sudo ntpdate -u serveraddress

where serveraddress is like watch.stdtime.gov.tw or 2.pool.ntp.org.


See the list of NTP pool time servers.
Now the time is correctly adjusted.

3. Shut down the Raspberry Pi:

sudo halt

4. Remove the power cable and wait for a while.

5. Connect to the power cable.

Unfortunately, the clock after powered up is delayed.

Update the current time while booting

1. Type this command:
sudo nano /etc/rc.local

2. Add the line after if [ "$_IP ]; then:
/usr/sbin/ntpdate -u serveraddress



3. Remove the power cable and wait for a while.

4. Connect to the power cable.

Now the time and date are correct!!

1 comment: