How to I set the time and date?


8 posts
by shawnerz » Thu Jul 05, 2012 3:09 am
All,
I feel really stupid asking a basic question, but I can't seem to set the time and date.
As I understand it, the pi has no realt time clock (RTC). Hence, there should be no /dev/rtc and the hwclock command should do nothing. Is this correct?

I am in the US. I edited /etc/timezone to America/New_York (and rebooted several times). When I type date, it still returns the time in the BST timezone. :(

I am not acting as a NTP server. Should I make any changes to ntp.conf? Is the pi already obtaining time from server X.debian.pool.ntp.org?
-Shawn
Posts: 13
Joined: Mon Jun 04, 2012 3:56 pm
by SirLagz » Thu Jul 05, 2012 6:27 am
dpkg-reconfigure tzdata
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044
Posts: 1704
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
by penguintutor » Thu Jul 05, 2012 7:29 am
The Raspberry Pi is already configured as an ntp client using the Debian ntp servers. As long as you have an Internet connection you should get the correct time.

If you don't have an Internet connection then you can use the date command to set the date / time appropriately.

eg.
sudo date -s "Jul 5 08:10"

The correct timezone for New York is
US/Eastern
This is what you should put in /etc/timezone

Or it's easier as per SirLagz comment using dpkg-reconfigure. That needs to be run as root - so using sudo:

sudo dpkg-reconfigure tzdata
User avatar
Posts: 338
Joined: Tue May 08, 2012 9:11 am
Location: UK
by Jim JKla » Thu Jul 05, 2012 7:36 am
If you use the wheezy image there's a timezone section in the raspi-config and there's stuff on the wiki on that.
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick
User avatar
Posts: 2195
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK
by shawnerz » Fri Jul 06, 2012 1:30 am
Penguintutor and SirLagz: thank you for the command. That worked. I really thought /etc/timezone would have been the place to do this, but I guess not.

Jim Jkla: I'm not using wheezy. I'm using debian "squeeze".
Posts: 13
Joined: Mon Jun 04, 2012 3:56 pm
by SirLagz » Fri Jul 06, 2012 1:43 am
No problems :)
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044
Posts: 1704
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
by techsurvivor » Sat Jul 14, 2012 4:20 am
Fix for the above you put in (for example if you're Eastern timezone in North America)

Code: Select all
America/Eastern


or Central
Code: Select all
America/Central
Posts: 4
Joined: Fri Jul 13, 2012 12:00 am
by groundup » Wed Dec 12, 2012 12:33 am
For archlinux:
systemctl enable openntpd.service
echo "US/Eastern" > /etc/timezone
rm /etc/localtime
ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime
Posts: 1
Joined: Wed Dec 12, 2012 12:29 am