Gateway 2.0 Clock loses time

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Gateway 2.0 Clock loses time

champson
I've noticed that with the following firmware, the clock loses time quite quickly.   The NTP client must work at least initially, as the time and date are correct to begin with at bootup.

e.g.  Currently the acutal time is 15:19 hrs,  but the clock in OHS displays:
Time 15:17:35 Thu 01.10.2020
Start time 11:03:24 Thu 01.10.2020

So after 4 hrs operation it has lost around 2 minutes.

Software version is:
ch> info
Kernel:       6.1.1
Compiler:     GCC 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
Architecture: ARMv7E-M
Core Variant: Cortex-M4F
Port Info:    Advanced kernel mode
Platform:     STM32F437 High Performance with DSP and FPU
Board:        Open Home Security STM32F4x7-2.0.4
Build time:   Sep 28 2020 - 16:08:31
ch>
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

vysocan
Administrator
Hello Charlie,

I have double checked here, NTP should sync every hour. I did some change thought and committed new build.

Let me know if problems persists.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

champson
Thanks!  I have upgraded and will continue to monitor.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

champson
I am still losing time for some reason.  I even went back to the default google NTP server but no joy.  I wonder now if it's something to do with me changing the time zone?  I changed the offsets to 0 and 60 to suit the UK timezone.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

vysocan
Administrator
Is the difference between gateway time and real time increasing steadily, or is it somehow fixed to let's say 2-3 minutes off?
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

vysocan
Administrator
One thing to check please, go to OHS console and type:
date set 315532801
This should set time to 1.1.1980.
Then wait if the time is set back to current real time within 1 hour by gateway itself.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

champson
Hi Adam,
I had some time today to reset the clock.  I also updated the gateway to the latest release (17th October 2020).   After a short while, the time was updated by NTP and seems to be correct for now.   I will keep an eye on it and see if it still loses time.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

vysocan
Administrator
Hello Charlie,

I've been playing with RTC for a while, to find out the deviation is not small. So I was thinking to implement some kind of auto correction. I've implement new line in RTC web interface:
Last deviation: 0 second(s)

And then found out that I left the RTC clock fed by internal resonator.
Sure gateway has it's own external one, which happen to be precise enough that I've not lost a one second in one hour update by NTC server.  

Good that you've asked. You can try on your side, new build is on GitHub.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

champson
Hi Adam,  that's good news :)   I will test tomorrow.   Cheers, Charlie.
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

champson
OK it looks fixed now :)
Reply | Threaded
Open this post in threaded view
|

Re: Gateway 2.0 Clock loses time

vysocan
Administrator
Great, then I conder this as fixed and I will remove:
Last deviation: 0 second(s)
from code.
Not that it matters for web interface, but calculation takes some time in SET_SNTP macro which should be as fast as possible,