Scotty T
Posts: 48
Joined: Wed May 30, 2012 2:51 pm

System Clock?

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?

User avatar
SN
Posts: 1012
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: System Clock?

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 ?

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: System Clock?

Fri Jun 01, 2012 1:36 pm

NTP is enabled by default in Debian.

No need to worry.

Scotty T
Posts: 48
Joined: Wed May 30, 2012 2:51 pm

Re: System Clock?

Fri Jun 01, 2012 1:39 pm

where is the ntp configuration? I'd like to review it.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: System Clock?

Fri Jun 01, 2012 1:46 pm

/etc/ntp.conf

In case you are wondering, I found it in 5 seconds with the command
sudo find /etc | grep ntp

piguy79
Posts: 17
Joined: Tue Apr 17, 2012 10:41 pm

Re: System Clock?

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?

godFather89
Posts: 150
Joined: Fri May 18, 2012 9:40 am
Location: Timisoara, RO

Re: System Clock?

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.

User avatar
jecxjo
Posts: 158
Joined: Sat May 19, 2012 5:22 pm
Location: Minneapolis, MN (USA)

Re: System Clock?

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.
xmpp: jecxjo@dukgo.com
Blog: http://jecxjo.motd.org/code

jeradsaxton
Posts: 1
Joined: Sat Aug 04, 2012 2:17 am

Re: System Clock?

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

jbranko
Posts: 4
Joined: Tue Jul 17, 2012 7:48 pm
Location: Slovenia

Re: System Clock?

Sun Aug 12, 2012 1:09 pm

Hi.
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.

BlackJack
Posts: 288
Joined: Sat Aug 04, 2012 8:28 am
Contact: Website

Re: System Clock?

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 raspberrypi.org download section start sudo raspi-config and set the correct time zone.

Code: Select all

while not self.asleep():
    sheep += 1

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

Re: System Clock?

Sun Aug 12, 2012 3:33 pm

Got it! Now I'm on French time.

Many thanks

David

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 6 guests