ltq-vdsl/ltq-adsl: fix elapsed time calculation
authorJan Hoffmann <jan@3e8.eu>
Mon, 25 Apr 2022 19:52:39 +0000 (21:52 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Tue, 7 Jun 2022 19:36:58 +0000 (21:36 +0200)
commit8f4b5fdd5f1a2a85f3b16da69a03edf1c3470369
treed16dbaa05c08ca414a7c6ba8db66cc665b49b01d
parentea0744fbc699e030b2917f5fa2493068cab2b60f
ltq-vdsl/ltq-adsl: fix elapsed time calculation

The driver maintains elapsed times by repeatedly accumulating the time
since the previous update in a loop. For the elapsed showtime time, the
time difference is truncated to seconds before adding it, leading to a
sizable error over time.

Move the truncation to before calculation of the time difference in
order to remove this error. Also maintain the total elapsed time in the
same way in full seconds, to prevent the unsigned 32-bit counter from
wrapping around after about 50 days.

Testing on a VR9 device shows that the reported line uptime now matches
the actual elapsed wall time. The ADSL variant is only compile-tested,
but it should also work as the relevant code is identical.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
(cherry picked from commit db4bf4b968c0da035d98e7771fc993af9d6f742b)
package/kernel/lantiq/ltq-adsl/Makefile
package/kernel/lantiq/ltq-adsl/patches/200-fix-elapsed-time.patch [new file with mode: 0644]
package/kernel/lantiq/ltq-vdsl/Makefile
package/kernel/lantiq/ltq-vdsl/patches/200-fix-elapsed-time.patch [new file with mode: 0644]