`$end` won't be defined if the connection fails, and `$time` will be negative yielding a negative `$speed`.