Page 1 of 1

Clock is reset every few seconds

Posted: 2024-09-01 3:09
by wef
Hi,

I'm trying to set the clock but it keeps getting re-set to UTC+8 every few seconds. ntpd appears to be working OK. There's no crontab - so what is resetting the time?

[root@luckfox ~]# date
Sun Sep 1 11:02:53 UTC 2024
[root@luckfox ~]# hwclock -u -s
[root@luckfox ~]# hwclock #### hwclock is correct and set to UTC
Sun Sep 1 03:02:40 2024 0.000000 seconds
[root@luckfox ~]# ntpd -p cn.ntp.org.cn -qn
1 Sep 03:02:43 ntpd[1475]: ntpd 4.2.8p15@1.3728-o Mon Jul 8 12:26:38 UTC 2024 (1): Starting
1 Sep 03:02:43 ntpd[1475]: Command line: ntpd -p cn.ntp.org.cn -qn
1 Sep 03:02:43 ntpd[1475]: ----------------------------------------------------
1 Sep 03:02:43 ntpd[1475]: ntp-4 is maintained by Network Time Foundation,
1 Sep 03:02:43 ntpd[1475]: Inc. (NTF), a non-profit 501(c)(3) public-benefit
1 Sep 03:02:43 ntpd[1475]: corporation. Support and training for ntp-4 are
1 Sep 03:02:43 ntpd[1475]: available at https://www.nwtime.org/support
1 Sep 03:02:43 ntpd[1475]: ----------------------------------------------------
1 Sep 03:02:43 ntpd[1475]: proto: precision = 1.166 usec (-20)
1 Sep 03:02:43 ntpd[1475]: basedate set to 2024-06-26
1 Sep 03:02:43 ntpd[1475]: gps base set to 2024-06-30 (week 2321)
1 Sep 03:02:43 ntpd[1475]: restrict: ignoring line 11, address/host '[::1]' unusable.
1 Sep 03:02:43 ntpd[1475]: Listen and drop on 0 v4wildcard 0.0.0.0:123
1 Sep 03:02:43 ntpd[1475]: Listen normally on 1 lo 127.0.0.1:123
1 Sep 03:02:43 ntpd[1475]: Listen normally on 2 wlan0 192.168.0.52:123
1 Sep 03:02:43 ntpd[1475]: Listening on routing socket on fd #19 for interface updates
1 Sep 03:03:17 ntpd[1475]: ntpd: time set +27.021468 s
ntpd: time set +27.021468s
[root@luckfox ~]# date ##### time is correct
Sun Sep 1 03:03:21 UTC 2024
[root@luckfox ~]# date
Sun Sep 1 03:03:28 UTC 2024
[root@luckfox ~]# date
Sun Sep 1 03:03:33 UTC 2024
[root@luckfox ~]# date
Sun Sep 1 11:03:49 UTC 2024 #### BANG - clock is reset

Re: Clock is reset every few seconds

Posted: 2024-09-02 6:17
by Crocodile
Hello, please try to set the time zone by referring to https://forums.luckfox.com/viewtopic.p ... C+8#p1054 .

Re: Clock is reset every few seconds

Posted: 2024-09-02 7:30
by wef
I have been through that.

/etc/profile only applies to shell logins. I want the correct time set in the camera - it is not affected by settings in /etc/profile.

Also, when I set the date/time with 'ntpd -q -x -b -g -t 1' it soon gets reset back to UTC-8 - which is Beijing time. It appears there's a ntpd job running somehow that does this.

Re: Clock is reset every few seconds

Posted: 2024-09-02 7:45
by Crocodile
The default startup configuration of rkipc has NTPD time synchronization enabled. You can disable this by modifying the [network.ntp] enable property to 0 in the /oem/usr/share/rkipc-300w.ini file.

Re: Clock is reset every few seconds

Posted: 2024-09-02 8:22
by wef
OK thanks! The system now comes up in UTC which is at least understandable.

Having ntpd run by the camera app is quite peculiar - but given that's the case, is there a way to specify a TZ in that rkipc-300w.ini file?

Re: Clock is reset every few seconds

Posted: 2024-09-03 8:27
by Crocodile
We haven't tested this, but you can refer to the implementation in <Luckfox Pico Sdk>/project/app/rkipc/rkipc/common/network/ntp.c. In rkipc, NTP is set up to configure the OSD timestamp.

Re: Clock is reset every few seconds

Posted: 2024-09-05 3:53
by wef
thanks for the tip!