System Clock?

General programming chat and advice for beginners

12 posts
by Scotty T » Fri Jun 01, 2012 1:31 pm
So there is no battery on board. How does Pi keep the time?
I'm assuming it doesn't.

Is there a built in ntp for debain squeeze or does one need to be install. If so, which is the best one to use?
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by SN » Fri Jun 01, 2012 1:36 pm
thats right - on the debian image at least it will remind you to set the time if you have no internet connection, but it does make a best guess of the time (based on the last time it had before it was shutdown last time)
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1012
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
by bredman » Fri Jun 01, 2012 1:36 pm
NTP is enabled by default in Debian.

No need to worry.
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm
by Scotty T » Fri Jun 01, 2012 1:39 pm
where is the ntp configuration? I'd like to review it.
Posts: 48
Joined: Wed May 30, 2012 2:51 pm
by bredman » Fri Jun 01, 2012 1:46 pm

In case you are wondering, I found it in 5 seconds with the command
sudo find /etc | grep ntp
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm
by piguy79 » Tue Jun 05, 2012 5:00 am
does the raspberry pi keep time with software? i'm trying to understand if i can use timed events in my programming. i have an original xbox and when i plug it in it asks me for the time and date and then after i type it in it keeps time somehow until i unplug it again is the raspberry pi like that or is it totaly without any concept of time?
Posts: 17
Joined: Tue Apr 17, 2012 10:41 pm
by godFather89 » Tue Jun 05, 2012 5:15 am
No operating system can work without the sense of time. Most likely, it uses a timer embedded in the ARM.
Posts: 150
Joined: Fri May 18, 2012 9:40 am
Location: Timisoara, RO
by jecxjo » Tue Jun 05, 2012 1:38 pm
If you look in the BCM2835 documentation Chapter 12 covers the System Timer internal to the CPU. This is the peripheral you'd use to calculate time changes on your system. There is a 64-bit free running counter and if you were to catch the interrupt when this is triggered, do a little math based on your clock frequency and now you have a clock. Since there is no battery backed Real Time Clock on this board you'd have to reset your current "Time" using NTP as stated in previous posts.
User avatar
Posts: 158
Joined: Sat May 19, 2012 5:22 pm
Location: Minneapolis, MN (USA)
by jeradsaxton » Sat Aug 04, 2012 2:27 am
ok maybe im an idiot, but i have tried to change the system clock with no avail. i have wheezy installed and functioning but i cannot change the time. PLEASE HELP getting very frustrated
Posts: 1
Joined: Sat Aug 04, 2012 2:17 am
by jbranko » Sun Aug 12, 2012 1:09 pm
System clock on my rpy is for example 15:00. Because I'm in another timezone I want to set system clock to 16:00. Can I do this permanently? I set correct time, but when I restart rpy, time goes back for 1 hour.Thank you for help.
Posts: 4
Joined: Tue Jul 17, 2012 7:48 pm
Location: Slovenia
by BlackJack » Sun Aug 12, 2012 3:21 pm
@jbranko: You should not change the clock but tell the system your time zone. If you are using the wheezy debian image from the download section start sudo raspi-config and set the correct time zone.
Code: Select all
while not self.asleep():
    sheep += 1
Posts: 288
Joined: Sat Aug 04, 2012 8:28 am
by DavidDunn » Sun Aug 12, 2012 3:33 pm
Got it! Now I'm on French time.

Many thanks

Posts: 4
Joined: Mon Aug 06, 2012 2:26 pm