- if (old->is_connected != new->is_connected
- || old->current_connection_duration != new->current_connection_duration
- || old->total_connected_duration != new->total_connected_duration) {
- printf(" %sconnected (%u ms), total %u ms connected\n",
- new->is_connected ? "" : "not ",
- new->current_connection_duration,
- new->total_connected_duration);
+ if (old->is_connected != new->is_connected) {
+ printf(" %sconnected\n", new->is_connected ? "" : "dis");
+ }
+ if (old->last_connected != new->last_connected
+ || (old->msec_since_connect != new->msec_since_connect - delta
+ && !(old->msec_since_connect == UINT_MAX
+ && new->msec_since_connect == UINT_MAX))
+ || (old->total_connected_duration != new->total_connected_duration - delta
+ && !(old->total_connected_duration == 0
+ && new->total_connected_duration == 0))) {
+ printf(" last connected %u ms ago, connected %u ms total\n",
+ new->msec_since_connect, new->total_connected_duration);
+ }
+ if (old->last_disconnected != new->last_disconnected
+ || (old->msec_since_disconnect != new->msec_since_disconnect - delta
+ && !(old->msec_since_disconnect == UINT_MAX
+ && new->msec_since_disconnect == UINT_MAX))) {
+ printf(" disconnected at %llu ms (%u ms ago)\n",
+ new->last_disconnected, new->msec_since_disconnect);