site  contact  subhomenews

Set date if no hardware clock

June 29, 2012 — BarryK
Squeezed Arm Puppy for the Raspberry Pi is built with 'Psync', an application created by tasmod to set the time/date from the Internet.

The first time that you bootup RP, if there is an Internet connection then QuickSetup will offer to run Psync.

However, if you don't have an Internet connection, then the date will be January 1, 1970. You would have to run 'Set date and time' in the 'Desktop' menu. Running with such an old date can cause problems.

So, I thought that Puppy should detect if there is no hardware clock, then set the date to something reasonable. I modified /etc/rc.d/rc.country and rc.shutdown.
rc.country will set the date/time to that when the Puppy was built (my local time here in Western Australia). rc.shutdown will save the time/date at shutdown, rc.country will read that at next bootup.

So, even though the time/date will be wrong, it won't be wildly wrong. It will also keep updating every time you bootup, but will fall behind, until of course you get onto the Internet.

Woof commit:
http://bkhome.org/fossil/woof2.cgi/info/6de4ee9075

Tags: woof