Run su to switch to user root
pi@raspberrypi:~ $ su
Password:
Run the date -R command to view the time
root@raspberrypi:/home/pi# date -R
Sun, 13 Oct 2019 09:53:10 +0000
Run dpkg-reconfigure tzdata to change the time zone to asia/shanghai
root@raspberrypi:/home/pi# dpkg-reconfigure tzdata
Current default time zone: 'Asia/Shanghai'
Local time is now: Sun Oct 13 17:53:36 CST 2019.
Universal Time is now: Sun Oct 13 09:53:36 UTC 2019.
执行apt-get install ntpdate
root@raspberrypi:/home/pi# apt-get install ntpdate
Reading package lists... Done
Building dependency tree
Reading state information... Done
ntpdate is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 310 not upgraded.
设置ntpdate ntp.sjtu.edu.cnSet ntpdate ntp.sjtu.edu.cn
root@raspberrypi:/home/pi# ntpdate ntp.sjtu.edu.cn
13 Oct 17:53:54 ntpdate[1714]: the NTP socket is in use, exiting
data check time is correct
root@raspberrypi:/home/pi# date
Sun 13 Oct 17:53:59 CST 2019
root@raspberrypi:/home/pi#