There are no floating point numbers. There is time.
The RTT is in
nanoseconds.
So @rextended is correct that "/1000" would get you
milliseconds...
/tool netwatch add disabled=no down-script=": log warning \"RTT Avg \$\"rtt-avg\" Loss Percent \$\"loss-percent\" \"" host=8.8.8.8 http-codes="" interval=8s packet-count=4 test-script="" thr-avg=50ms thr-loss-count=2 thr-loss-percent=10% type=icmp up-script=": log warning \"RTT Avg \$(\$\"rtt-avg\"/1000)ms Loss Percent \$\"loss-percent\"\""
While there is the new :tonsec to go from time to nanoseconds... there is NOT a reciprocal to get nanoseconds to a "time" object :(
If values are less then 1sec, this get the right result:
{
:local ns 25543
:put [:totime "$($ns/1000000).$($ns/1000)$($ns%1000)"]
}
# 00:00:00.255340
If greater than 1 seconds, the milliseconds will be wrong, so ~500ms off — but RTT 1second would already be a problem... This could be fixed with more code/workarounds.
I might be missing something...but even with the new :tonsec... there isn't a reverse since [:totime] expect either string or num
in seconds — that solve this problem better....