R3ZNOR
Posts: 12
Joined: Tue Jan 05, 2016 4:14 pm
Location: Northumberland

Adjusting Time and Date

Sat Jan 16, 2016 10:11 pm

With the help of this site I have managed to get my new RPi 2 booted. All is great except the clock in the top righthand corner is 15m slow and the date is 2mths behind.

I have tried manually adjusting the date but it resets to 2mths ago. I can't see anywhere to adjust the time.

Any hints gratefully appreciated, thanks R3zn0r
Current Status: Absolute beginner keen to learn

malicious
Posts: 96
Joined: Thu Jul 24, 2014 10:07 pm
Location: USA

Re: Adjusting Time and Date

Sun Jan 17, 2016 12:12 am

If your timezone is off, it can be reset under "Internationalisation Options" in raspi-config. With Raspbian or Ubuntu, this command in a terminal will accomplish the same:

sudo dpkg-reconfigure tzdata

What is the output of the following terminal command?

ps -ef | grep ntpd

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Adjusting Time and Date

Sun Jan 17, 2016 1:20 pm

Open a command window
sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start
exit
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

R3ZNOR
Posts: 12
Joined: Tue Jan 05, 2016 4:14 pm
Location: Northumberland

Re: Adjusting Time and Date

Mon Jan 18, 2016 12:07 pm

Great thanks for the responses. I will give them a try.
Current Status: Absolute beginner keen to learn

Aydan
Posts: 727
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: Adjusting Time and Date

Mon Jan 18, 2016 3:34 pm

DougieLawson wrote:Open a command window
sudo /etc/init.d/ntp stop --> this stops the network time daemon which normally updates the time form the internet
sudo ntpd -q -g --> forces a time update from the internet
sudo /etc/init.d/ntp start --> restarts the network time daemon for automatic time updates
exit --> closes the terminal console
[/color]
All this of course only works with an internet connection.
The time you see is the one that the kernel was compiled at. The Raspberry doesn't have a persistent hardware clock like a PC. It uses a fake hw clock which periodically saves the time to a file on the SD-card. It will default to the kernel compile time if no fake hardware clock data is available. At boot time if there is an internet connection available, it will set the timefrom there. If no internet is available it uses the fake hardware clock time, usually the time of the last shutdown, or the kernel compile time.

Regards
Aydan

Return to “Troubleshooting”