Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that Raspberry Pi does not come with a system clock to save money. How can I keep system time though?

share|improve this question
up vote 34 down vote accepted

Software Solution

The most popular method of keeping system time is via the Network Time Protocol daemon (NTPd).

NTPd is the most common method to synchronize the software clock of a GNU/Linux system with internet time servers using the Network Time Protocol.

NTPd should already be installed and set up on the default operating system, Debian Squeeze. You will need to install and configure it manually though for Arch Linux.

First you should install NTP.

$ sudo pacman -S ntp

Now you can manually update it via the command line.

$ sudo ntpd -qg

Or you can add it to the list of daemons on start up by adding it to your /etc/rc.conf file. Like so.

# /etc/rc.conf
DAEMONS=(!hwclock ntpd)

Note that you need to disable hwclock by preceding it with an exclamation mark (!) in the daemons list.

Protip from mlp: If you add ntpdate to your list of daemons the time will be corrected after boot much faster. So your daemons list would look like so.

# /etc/rc.conf
DAEMONS=(!hwclock ntpd ntpdate)
share|improve this answer
ntpdate is deprecated: support.ntp.org/bin/view/Dev/DeprecatingNtpdate – Gergely Fehérvári Aug 12 '12 at 15:23
/etc/rc.conf is also deprecated. – rubenvb Feb 8 '13 at 22:32
if /etc/rc.conf is deprecated, what's the alternative? This is exactly what I need. – exabrial Apr 1 '13 at 14:17
@exabrial systemctl enable ntpd.service is similar to adding to /etc/rc.conf. – Lekensteyn May 10 '13 at 13:34

Hardware Solution

If you want to guarantee that the time on the RPi is always correct or want to maintain the time without a network connection, you will need to buy an expansion board with a Real Time Clock (RTC) on it: there is at least one available and at least one in development.

Available RTC Expansion Boards

RTC Expansion Boards in Development

share|improve this answer

For non-networked applications (or where network time might not be good enough), you can set your RTC clock (@Alex Chamberlain's answer) with time derived from a GPS receiver or a VLF receiver (in NW Europe this would be Rugby MSF). Both could be excellent solutions to field-deployed devices (robots, field monitoring, etc).

Both solutions would also make good hobby projects. I remember building a Rugby MSF receiver in the 1980s. An off the shelf GPS receiver ("puck") would give the time and date in the NMEA 0183 sentences - it would then be a simple coding project to extract this information.

share|improve this answer
For interest, the MSF time signal is actually now broadcast from Anthorn Radio Station in Cumbria, not Rugby. – tomfanning Nov 13 '12 at 16:18
Not living in the UK at the moment, I haven't driven down the M1 for a while: So have they taken down the 'forest'? (I assume the nearby naval masts at Daventry are still there) – winwaed Nov 13 '12 at 16:38
Not sure - I'm on the wrong side of the country for the M1. However, Rugby Radio Station appears to have stopped being active in mid 2007 according to en.wikipedia.org/wiki/Rugby_Radio_Station - with references to demolition, including a photo. And there's a video here: youtube.com/watch?v=bx2lhSUuGqU. However, there are masts still visible on Google Street View, which I'm fairly sure is newer imagery than 2007. – tomfanning Nov 14 '12 at 13:07
And looking around on Wikipedia, there's no mention of "naval" masts at Daventry so I must be mistaken - just a very old (now dismantled) transmitter to the Empire. So now the M1 drive is even more boring! – winwaed Nov 14 '12 at 14:03

Install the NTP daemon on Arch Linux with systemd:

sudo pacman -S ntp
sudo systemctl enable ntpd
sudo systemctl start ntpd

Also make sure your timezone is set correctly, in my case:

sudo rm /etc/localtime
sudo ln -s  /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
share|improve this answer

If you don't want to have NTP running on your system the whole time you can use one of a few different options to set the time:

  • ntpdate - Once installed it sets the system up to obtain the time when any interface comes up (although 'deprecated' it's still fairly widely used).
  • rdate - Simpler and lighter weight approach, though a bit less accurate.
  • tlsdate - A more secure option which uses an TLS/SSL server as a time source.

Obviously your clock wont be as accurate as using NTP since all clocks do drift, and also since these apps only use a single time source they can potentially result in setting the incorrect time if their chosen source has a problem.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.