net/mwan3: use uptime for ubus age info

If the date is changed by ntp the age value of mwan3 on ubus could jitter.
Use instead the uptime value from /proc/uptime which will not change during
system run.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert
2017-11-09 09:57:58 +01:00
parent 84e5012e88
commit 267c0eeaed
3 changed files with 10 additions and 2 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
. /lib/functions.sh
. /lib/functions/network.sh
. /usr/share/libubox/jshn.sh
. /lib/mwan3/common.sh
MWAN3TRACK_STATUS_DIR="/var/run/mwan3track"
@@ -47,7 +48,7 @@ get_mwan3_status() {
time_p="$(cat "$MWAN3TRACK_STATUS_DIR/${iface}/TIME")"
[ -z "${time_p}" ] || {
time_n="$(date +'%s')"
time_n="$(get_uptime)"
let age=time_n-time_p
}