Page 1 of 3

Loosing Time

Posted: 08 Mar 2018, 09:15
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

Re: Loosing Time

Posted: 08 Mar 2018, 09:24
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...

Re: Loosing Time

Posted: 08 Mar 2018, 10:06
by Timo
Try a "sudo hwclock -w" after setting the time and date via the "date" command.

Re: Loosing Time

Posted: 08 Mar 2018, 10:08
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?

Re: Loosing Time

Posted: 08 Mar 2018, 10:10
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?

Re: Loosing Time

Posted: 08 Mar 2018, 10:23
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?

Re: Loosing Time

Posted: 08 Mar 2018, 12:25
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?

Re: Loosing Time

Posted: 08 Mar 2018, 13:16
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"

Re: Loosing Time

Posted: 08 Mar 2018, 17:25
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.

Re: Loosing Time

Posted: 09 Mar 2018, 09:26
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?