- stats->current_connection_duration
- = reconnect_get_connection_duration(fsm, now);
- stats->total_connected_duration = (stats->current_connection_duration
- + fsm->total_connected_duration);
+ stats->msec_since_connect
+ = reconnect_get_last_connect_elapsed(fsm, now);
+ stats->msec_since_disconnect
+ = reconnect_get_last_disconnect_elapsed(fsm, now);
+ stats->total_connected_duration = fsm->total_connected_duration
+ + (is_connected_state(fsm->state)
+ ? reconnect_get_last_connect_elapsed(fsm, now) : 0);