Loosing Time

Topics about the Hardware of Revolution Pi
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Loosing Time

Post by f.fallon »

Hi,

I went to install a rev pi yesterday on site with a customer. The network it was connected to does not have the internet so it cannot contact a time server. So I set the time from the command line. I then rebooted the device from ssh. The device then looses its time. Why does the pi loose its time when rebooted? Is it not supposed to hold the time for 24 hours?

Kind Regards,
Frank
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Loosing Time

Post by volker »

You need to use the correct LINUX command to get this written into the HW clock. Our LINUX expert will answer later and tell you how to do it correctly...
Unser RevPi Motto: Don't just claim it - make it!
Timo
Posts: 44
Joined: 25 Jan 2017, 10:08

Re: Loosing Time

Post by Timo »

Try a "sudo hwclock -w" after setting the time and date via the "date" command.
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Re: Loosing Time

Post by f.fallon »

Timo wrote: 08 Mar 2018, 10:06 Try a "sudo hwclock -w" after setting the time and date via the "date" command.
Can you explain to me what that command does please?
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Re: Loosing Time

Post by f.fallon »

volker wrote: 08 Mar 2018, 09:24 You need to use the correct LINUX command to get this written into the HW clock. Our LINUX expert will answer later and tell you how to do it correctly...
Ok Great, what would happen after 24 hours of no power, would that mean it would loose its time?
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Loosing Time

Post by volker »

No! HW Clock means the RTC chip which is buffered by a gold cap and will keep the time for nearly 48h. But not every Linux command does write the time into the RTC. Some commands are only setting the time in the linux time-mechanisms. This time is not constantly copied into the RTC chip. If you directly reboot the system without shutdown you will loose your setting if not using the correct time setting command which directly writes into the RTC. Does that make sense to you?
Unser RevPi Motto: Don't just claim it - make it!
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Re: Loosing Time

Post by f.fallon »

volker wrote: 08 Mar 2018, 10:23 No! HW Clock means the RTC chip which is buffered by a gold cap and will keep the time for nearly 48h. But not every Linux command does write the time into the RTC. Some commands are only setting the time in the linux time-mechanisms. This time is not constantly copied into the RTC chip. If you directly reboot the system without shutdown you will loose your setting if not using the correct time setting command which directly writes into the RTC. Does that make sense to you?
Yes that makes sense thank you. If we wanted a longer RTC period that is longer than 48hours is there a way to do that, even with an addon module which connects to GPIO?
User avatar
lukas
Expert
Posts: 186
Joined: 13 Feb 2017, 10:29

Re: Loosing Time

Post by lukas »

We recommend using timedatectl(1) as this will set the system clock and also synchronize the system clock back to the RTC in one go. Example:

Code: Select all

sudo timedatectl set-time "2018-03-08 13:15:00"
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Loosing Time

Post by volker »

There are no GPIOs to be used by any external hardware. You could think of implementing your own RTC in Karl's new maker-module (see forum's thread) but this would need to program your own kernel extension to get the RTC included in the Linux time mechanisms. The easiest way I could think of would be a modification to the RevPi Core hardware (adding capacity to the gold cap which is placed under the CM). But that would be a maker thing, no series product.
Unser RevPi Motto: Don't just claim it - make it!
f.fallon
Posts: 21
Joined: 20 Feb 2018, 15:38

Re: Loosing Time

Post by f.fallon »

volker wrote: 08 Mar 2018, 17:25 There are no GPIOs to be used by any external hardware. You could think of implementing your own RTC in Karl's new maker-module (see forum's thread) but this would need to program your own kernel extension to get the RTC included in the Linux time mechanisms. The easiest way I could think of would be a modification to the RevPi Core hardware (adding capacity to the gold cap which is placed under the CM). But that would be a maker thing, no series product.
Sorry but this isn't really an option for us. I would have thought for an industrial device it would have had a battery backed RTC to improve on the standard pi setup. Do you have any future products that will have this?
Post Reply