[PATCH] ltq-vdsl/ltq-adsl: fix elapsed time calculation

Martin Blumenstingl martin.blumenstingl at googlemail.com
Fri Apr 29 11:15:17 PDT 2022

On Mon, Apr 25, 2022 at 9:55 PM Jan Hoffmann <jan at 3e8.eu> wrote:
> 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 at 3e8.eu>
Tested-by: Martin Blumenstingl <martin.blumenstingl at googlemail.com>

statistics seem fine to me with this, although I didn't test for 50+ days ;-)

Best regards,

More information about the openwrt-devel mailing list