lorawan-server icon indicating copy to clipboard operation
lorawan-server copied to clipboard

DeviceTimeAns MAC command return incorrect time value to end node

Open danluck opened this issue 4 years ago • 0 comments

Distribution type: binary Gotthardp version: 0.6.7 Hardware type: PC Server OS version: Windows Server 2016 Erlang version: 22 TimeZone: UTC (+3)

Our end node devices periodically receive incorrect time from LoRaWAN server by DeviceTimeAns MAC command about 1-2 minutes bigger than actual UTC time with leap seconds taking acount. To eliminate problem with end node device we check another LoRaWAN Server - "Actility" and don't get any time issues. Then with Gotthardp LoRaWAN server for debug purpose we created one test end node that send DeviceTimeReq MAC-command in uplink every 3s for 100 times. Here is fragment of log file attached: "Gotthardp_0_6_7_log_DeviceTimeAns.txt".

Local server time on server PC is correct (that showed at logs) but time sent to end node is bigger than actual time about +0...+60 seconds.

Example (from attached log file): 2021-11-17 09:59:17.020 [debug] <0.367.0>@lorawan_mac_commands:build_fopts:77 90123456 <- [{device_time_ans,1321167593731}] Local time is "09:59:17" but time at DeviceTimeAnd MAC command equals "09:59:35" local time (UTC +3), difference is "+21s".

Next time we get this value: 2021-11-17 09:59:20.116 [debug] <0.369.0>@lorawan_mac_commands:send_device_time:275 DeviceTimeAns: time: 1321167599839 difference is "+21s" (at 09:59:41).

2021-11-17 09:59:23.221 [debug] <0.373.0>@lorawan_mac_commands:send_device_time:275 DeviceTimeAns: time: 1321167605948 difference is "+24s" (at 09:59:47)

Another case: 2021-11-17 10:00:29.088 [debug] <0.409.0>@lorawan_mac_commands:send_device_time:275 DeviceTimeAns: time: 1321167677816 difference is "+30s". Gotthardp_0_6_7_log_DeviceTimeAns.txt

Upd. Locally we use this fix: https://github.com/danluck/lorawan-server/commit/5e4186954608046efa29250d460f7b8e6d3f7a8 lorawan_mac_commands.zip

danluck avatar Nov 17 '21 09:11 danluck