diff --git a/lib/bfd.c b/lib/bfd.c index 2222bb954737..6dcce66e3452 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -809,6 +809,8 @@ void bfd_sess_show(struct vty *vty, struct json_object *json, { json_object *json_bfd = NULL; char time_buf[64]; + time_t epoch_tbuf; + char epoch_str_buf[MONOTIME_STRLEN]; if (!bsp) return; @@ -840,13 +842,15 @@ void bfd_sess_show(struct vty *vty, struct json_object *json, } bfd_last_update(bsp->bss.last_event, time_buf, sizeof(time_buf)); + epoch_tbuf = time(NULL) - (monotime(NULL) - bsp->bss.last_event); if (json) { json_object_string_add(json_bfd, "status", bfd_get_status_str(bsp->bss.state)); json_object_string_add(json_bfd, "lastUpdate", time_buf); } else - vty_out(vty, " Status: %s, Last update: %s\n", - bfd_get_status_str(bsp->bss.state), time_buf); + vty_out(vty, " Status: %s, Last update: %s, %s\n", + bfd_get_status_str(bsp->bss.state), time_buf, + ctime_r(&epoch_tbuf, epoch_str_buf)); if (json) json_object_object_add(json, "peerBfdInfo", json_bfd); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ad7c4b6d09df..0d9e0b4a56f6 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -4623,6 +4623,7 @@ static void show_ip_ospf_neighbour_brief(struct vty *vty, long time_val = 0; char uptime[OSPF_TIME_DUMP_SIZE]; time_t epoch_tbuf = 0; + char epoch_str_buf[MONOTIME_STRLEN]; if (nbr->ts_last_progress.tv_sec || nbr->ts_last_progress.tv_usec) time_val = @@ -4726,8 +4727,8 @@ static void show_ip_ospf_neighbour_brief(struct vty *vty, vty_out(vty, "%-15pI4 %3d %-15s ", &nbr->router_id, nbr->priority, msgbuf); - vty_out(vty, "%-15s ", - ospf_timeval_dump(&res, uptime, sizeof(uptime))); + vty_out(vty, "%-15s %-25s ", ospf_timeval_dump(&res, uptime, sizeof(uptime)), + ctime_r(&epoch_tbuf, epoch_str_buf)); vty_out(vty, "%9s ", ospf_timer_dump(nbr->t_inactivity, timebuf, diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index f7976ff6fc4b..92037341f157 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -854,11 +854,13 @@ static void igmp_group_print(struct interface *ifp, struct vty *vty, bool uj, char group_str[INET_ADDRSTRLEN]; char hhmmss[PIM_TIME_STRLEN]; char uptime[PIM_TIME_STRLEN]; + time_t epoch_tbuf; pim_inet4_dump("", grp->group_addr, group_str, sizeof(group_str)); pim_time_timer_to_hhmmss(hhmmss, sizeof(hhmmss), grp->t_group_timer); pim_time_uptime(uptime, sizeof(uptime), now - grp->group_creation); + epoch_tbuf = time(NULL) - (monotime(NULL) - (UPTIMESECS(grp->group_creation))); if (uj) { json_object_object_get_ex(json, ifp->name, &json_iface); @@ -936,6 +938,7 @@ static void igmp_group_print(struct interface *ifp, struct vty *vty, bool uj, } } } else { + char epoch_str_buf[MONOTIME_STRLEN]; if (detail) { struct listnode *srcnode; struct gm_source *src; @@ -947,31 +950,22 @@ static void igmp_group_print(struct interface *ifp, struct vty *vty, bool uj, pim_inet4_dump("", src->source_addr, source_str, sizeof(source_str)); - vty_out(vty, - "%-16s %-15s %4s %8s %-15s %d %8s\n", - ifp->name, group_str, + vty_out(vty, "%-16s %-15s %4s %8s %-15s %d %8s %-25s\n", ifp->name, + group_str, grp->igmp_version == 3 - ? (grp->group_filtermode_isexcl - ? "EXCL" - : "INCL") + ? (grp->group_filtermode_isexcl ? "EXCL" : "INCL") : "----", - hhmmss, source_str, grp->igmp_version, - uptime); + hhmmss, source_str, grp->igmp_version, uptime, + ctime_r(&epoch_tbuf, epoch_str_buf)); } return; } - vty_out(vty, "%-16s %-15s %4s %8s %4d %d %8s\n", ifp->name, - group_str, - grp->igmp_version == 3 - ? (grp->group_filtermode_isexcl ? "EXCL" - : "INCL") - : "----", - hhmmss, - grp->group_source_list - ? listcount(grp->group_source_list) - : 0, - grp->igmp_version, uptime); + vty_out(vty, "%-16s %-15s %4s %8s %4d %d %8s %-25s\n", ifp->name, group_str, + grp->igmp_version == 3 ? (grp->group_filtermode_isexcl ? "EXCL" : "INCL") + : "----", + hhmmss, grp->group_source_list ? listcount(grp->group_source_list) : 0, + grp->igmp_version, uptime, ctime_r(&epoch_tbuf, epoch_str_buf)); } } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index daa79cbc7722..cc614d400055 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -629,8 +629,11 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, char up_str[MONOTIME_STRLEN]; bool first_p = true; bool nhg_from_backup = false; + time_t epoch_tbuf; + char epoch_str_buf[MONOTIME_STRLEN]; uptime2str(re->uptime, up_str, sizeof(up_str)); + epoch_tbuf = time(NULL) - (monotime(NULL) - (UPTIMESECS(re->uptime))); /* If showing fib information, use the fib view of the * nexthops. @@ -804,7 +807,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, } show_route_nexthop_helper(vty, re, nexthop); - vty_out(vty, ", %s\n", up_str); + vty_out(vty, ", %s, %s\n", up_str, ctime_r(&epoch_tbuf, epoch_str_buf)); } /* If we only had backup nexthops, we're done */ @@ -1197,9 +1200,10 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe, json_object *json = NULL; json_object *json_backup_nexthop_array = NULL; json_object *json_backup_nexthops = NULL; - + time_t epoch_tbuf; uptime2str(nhe->uptime, up_str, sizeof(up_str)); + epoch_tbuf = time(NULL) - (monotime(NULL) - (UPTIMESECS(nhe->uptime))); if (json_nhe_hdr) json = json_object_new_object(); @@ -1219,6 +1223,8 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe, vrf_id_to_name(nhe->vrf_id)); } else { + char epoch_str_buf[MONOTIME_STRLEN]; + vty_out(vty, "ID: %u (%s)\n", nhe->id, zebra_route_string(nhe->type)); vty_out(vty, " RefCnt: %u", nhe->refcnt); @@ -1229,7 +1235,7 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe, nhe->timer)); vty_out(vty, "\n"); - vty_out(vty, " Uptime: %s\n", up_str); + vty_out(vty, " Uptime: %s, %s\n", up_str, ctime_r(&epoch_tbuf, epoch_str_buf)); vty_out(vty, " VRF: %s\n", vrf_id_to_name(nhe->vrf_id)); }