FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
200 views 0 comments
by anonymous

Hello,

I have a RUTX11 configured to sync time with gps, in a time zone with DST:

root@lgrrutx:~# cat /etc/TZ
CET-1CEST,M3.5.0,M10.5.0/3

The time is:

root@lgrrutx:~# date
Sun May 16 12:22:28 CEST 2021

This is correct. Now set the GPS time update interval to 5m, strace the ntp_gps process and wait a little:

root@lgrrutx:~# ps |grep gps
 5532 root      3704 S    /usr/sbin/gpsd -a /dev/ttyUSB1 -b 115200
10164 root      1220 S    /usr/sbin/ntp_gps
10879 root      1136 R    grep gps
root@lgrrutx:~# strace -v -f -ff -y -s 1024 -o ng -p 10164
strace: Process 10164 attached

while checking the time:

root@lgrrutx:~# date
Sun May 16 12:27:36 CEST 2021
root@lgrrutx:~# date
Sun May 16 11:27:54 CEST 2021

The last one is incorrect, it is off by one hour.

The strace output contains:

epoll_pwait(3<anon_inode:[eventpoll]>, [{EPOLLIN, {u32=3199897108, u64=3199897108}}], 10, -1, NULL, 8) = 1                                         
recvmsg(6<socket:[86476993]>, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\0\5\247]\367\265\\:\0\0\0\370", iov_len=12}], msg_iovlen=1, msg_c
recvmsg(6<socket:[86476993]>, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\n\0\0\5\1\0\0\0\3\0\0\10\313%\348\4\0\0\rposition\0\0\0\0\f\0\0\t
munmap(0xb6ff8000, 27)                  = 0                                                                                                        
open("/etc/TZ", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC) = 7</tmp/TZ>                                                                            
fstat64(7</tmp/TZ>, {st_dev=makedev(0, 0xd), st_ino=2774, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_si
mmap2(NULL, 27, PROT_READ, MAP_SHARED, 7</tmp/TZ>, 0) = 0xb6ff8000                                                                                 
close(7</tmp/TZ>)                       = 0                                                                                                        
munmap(0xb6ff8000, 27)                  = 0                                                                                                        
open("/etc/TZ", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC) = 7</tmp/TZ>                                                                            
fstat64(7</tmp/TZ>, {st_dev=makedev(0, 0xd), st_ino=2774, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_si
mmap2(NULL, 27, PROT_READ, MAP_SHARED, 7</tmp/TZ>, 0) = 0xb6ff8000                                                                                 
close(7</tmp/TZ>)                       = 0                                                                                                        
clock_settime(CLOCK_REALTIME, {tv_sec=1621157272, tv_nsec=35000000}) = 0

The parameter passed to clock_settime() is wrong, according to https://www.epochconverter.com/ 1621157272 translates to:



Convert epoch to human-readable date and vice versa

 Timestamp to Human date  [batch convert]

Supports Unix timestamps in seconds, milliseconds, microseconds and nanoseconds.

Assuming that this timestamp is in seconds:
GMT: Sun, 16 May 2021 09:27:52 GMT
Your time zone: Sun May 16 2021 11:27:52 GMT+0200 (Central European Summer Time)

It appears that ntp_gps doesn't handle DST correctly. the ntp server gives wrong references to other devices in the network making centralized logs hard to follow.

Of course it is possible to completely disable GPS synchronisation but then all references are lost if the router reboots and the mobile network is down.

Regards,

1 Answer

0 votes
by anonymous
Hello,

Thank you flebourse,

your feedback is really appreciated and has been forwarded to our RnD department.

EB.
Best answer