setting the clock to my local time


10 posts
by piguy » Mon Jun 18, 2012 11:15 am
Hi guys and gals,
I can't find where you set the clock to local time. I believe you have to set each time you boot, but where do you do it?????? I'm using 'squeeze'
I want to install apache2. The dependancies check out okay but then keep getting "failed to get files from server"
I want to eliminate the incorrect time setting before I move on.
I found my way to ntp.conf but not sure about changing anything. It reads like the time should be updated automaticaly when you connect to the internet?

Yours sincerely,
Piguy.
Posts: 5
Joined: Mon Jun 18, 2012 10:47 am
by texy » Mon Jun 18, 2012 2:14 pm
Using the Debian image downloads, the time is automatically set if you have a valid ethernet connection with npt.
If you try the new Wheezy image, there is a configuration script run first time only for setting locale time, keyboard, etc.

Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2451
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by piguy » Mon Jun 18, 2012 8:56 pm
Thanks for your reply Texy,

When I boot the pi with an internet connection, why doesn't ntp (network time protocol) update the time automatically?
Do I gather that if I didn't input an accurate time zone at the time zone prompt, when installing the operating system onto the sd card with my laptop, then I am stuck with it???
I notice that the time is correct in the minutes but not the hours.

There must be a config file that could use fixing?

Any assistance appreciated,
Thanks
Posts: 5
Joined: Mon Jun 18, 2012 10:47 am
by texy » Mon Jun 18, 2012 9:10 pm
Sounds like you haven't set your timezone. Where are you in the world and how far out is the time?
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2451
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by piguy » Mon Jun 18, 2012 9:28 pm
Thanks for the quick reply,

I sure I can remember setting it because at the time, the options for setting the time zone weren't as precise as like when I installed Ubuntu 12.04 on my laptop, it allowed me to select Brisbane Australia but had to settle for EST Eastern standard time.

I'm thinking I'll re install and pay more attention this time.

I'm assuming that with the time zone set correctly, that ntp will update the pi time each time it's connected to the internet? Correct?

Thanks
Posts: 5
Joined: Mon Jun 18, 2012 10:47 am
by piguy » Tue Jun 19, 2012 12:31 am
All right, I made a mistake. I didn't set a time zone because there isn't an opportunity to do so.
I downloaded the "squeezy" os and extracted it to the home folder of my laptop with the sd card inserted.
Then I ran dd bs=1M if=~/debian6-19-04-2012.img of=/dev/mmcblk0. As per the instructions.
There's no point at which you are asked for the time zone or keyboard layout.
Then I put the card in the pi and booted it perfectly. The time is still correct in the minutes, but the hours are still 9hours out. Therefore ntp is working properly. Adding an hour for daylight saving, that gives 10 hours which is the time difference between me here and 00hrs UTC.
Obviously the default time is 00hrs UTC.
I'd like to know how I set the correct time zone because I believe if it is wrong, you will have trouble connecting to different download servers. (apart from having the wrong timestamps on saved files etc.) Thanks in advance for any help.
Posts: 5
Joined: Mon Jun 18, 2012 10:47 am
by jojopi » Tue Jun 19, 2012 1:18 am
piguy wrote:I'd like to know how I set the correct time zone because I believe if it is wrong, you will have trouble connecting to different download servers. (apart from having the wrong timestamps on saved files etc.) Thanks in advance for any help.
Having the wrong time zone will not cause any such problems. Timestamps on files are stored in UTC and only converted to local time for display. So you can change time zone at any time, and different users on the system can even have different time zones, and the results are always correct.

Anyway, to change the system default time zone, see the wiki: http://elinux.org/R-Pi_Troubleshooting# ... _incorrect
User avatar
Posts: 2122
Joined: Tue Oct 11, 2011 8:38 pm
by texy » Tue Jun 19, 2012 6:11 am
piguy wrote:All right, I made a mistake. I didn't set a time zone because there isn't an opportunity to do so.
I downloaded the "squeezy" os and extracted it to the home folder of my laptop with the sd card inserted.
Then I ran dd bs=1M if=~/debian6-19-04-2012.img of=/dev/mmcblk0. As per the instructions.
There's no point at which you are asked for the time zone or keyboard layout.


It wont ask you questions at this point - this is just copying the image to the SD card, not setting it up, which is done when you run it in the pi.
To set the timezone, see this thread :
viewtopic.php?f=5&t=4977

How ever, I would suggest trying the new wheezy image here :
viewtopic.php?f=50&t=8071
as it runs a setup script when first booted up.

Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2451
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by piguy » Tue Jun 19, 2012 10:35 am
Hi texy and jojopi,

Thanks for the replies.
I re installed the os to the sd card and ran "dpkg reconfigure tzdata" and it did indeed allow me to set the time zone data. The clock is correct now.
Also, I bought a wired usb mouse and keyboard because some forums said they were having trouble with their internet connections when using a wireless kb and mouse.(Logitek K260). It did improve performance.
I don't know? Possibly the dongle draws more current than the pi likes. That could lower the voltage threshold and cause problems.
Anyway, I got apache2 installed and running at last.
I'll get another card and look at more operating systems. Why not?! That's what the pi is for.
Cheers
Posts: 5
Joined: Mon Jun 18, 2012 10:47 am
by Hans » Sun May 19, 2013 6:13 pm
Hi,

I found the time incorrect on my raspberry server, it was more than one hour off, i found the ntpd deamon was not running anymore. so : "cd /etc/init.d" "./ntp restart" and thing where fine after that. Don know why it stopped ...
Posts: 7
Joined: Sat Aug 04, 2012 7:03 pm