summaryrefslogtreecommitdiffstats
path: root/zebra/zserv.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zserv.c')
-rw-r--r--zebra/zserv.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 40aa9010c..7f806d82c 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -858,7 +858,6 @@ void zserv_event(struct zserv *client, enum zserv_event event)
#define ZEBRA_TIME_BUF 32
static char *zserv_time_buf(time_t *time1, char *buf, int buflen)
{
- struct tm tm;
time_t now;
assert(buf != NULL);
@@ -872,17 +871,9 @@ static char *zserv_time_buf(time_t *time1, char *buf, int buflen)
now = monotime(NULL);
now -= *time1;
- gmtime_r(&now, &tm);
-
- if (now < ONE_DAY_SECOND)
- snprintf(buf, buflen, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
- tm.tm_sec);
- else if (now < ONE_WEEK_SECOND)
- snprintf(buf, buflen, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
- tm.tm_min);
- else
- snprintf(buf, buflen, "%02dw%dd%02dh", tm.tm_yday / 7,
- tm.tm_yday - ((tm.tm_yday / 7) * 7), tm.tm_hour);
+
+ frrtime_to_interval(now, buf, buflen);
+
return buf;
}
@@ -1001,8 +992,6 @@ static void zebra_show_stale_client_detail(struct vty *vty,
struct zserv *client)
{
char buf[PREFIX2STR_BUFFER];
- struct tm tm;
- struct timeval tv;
time_t uptime;
struct client_gr_info *info = NULL;
struct zserv *s = NULL;
@@ -1028,26 +1017,13 @@ static void zebra_show_stale_client_detail(struct vty *vty,
if (ZEBRA_CLIENT_GR_ENABLED(info->capabilities)) {
if (info->stale_client_ptr) {
s = (struct zserv *)(info->stale_client_ptr);
- uptime = monotime(&tv);
+ uptime = monotime(NULL);
uptime -= s->restart_time;
- gmtime_r(&uptime, &tm);
-
- vty_out(vty, "Last restart time : ");
- if (uptime < ONE_DAY_SECOND)
- vty_out(vty, "%02d:%02d:%02d",
- tm.tm_hour, tm.tm_min,
- tm.tm_sec);
- else if (uptime < ONE_WEEK_SECOND)
- vty_out(vty, "%dd%02dh%02dm",
- tm.tm_yday, tm.tm_hour,
- tm.tm_min);
- else
- vty_out(vty, "%02dw%dd%02dh",
- tm.tm_yday / 7,
- tm.tm_yday - ((tm.tm_yday / 7)
- * 7),
- tm.tm_hour);
- vty_out(vty, " ago\n");
+
+ frrtime_to_interval(uptime, buf, sizeof(buf));
+
+ vty_out(vty, "Last restart time : %s ago\n",
+ buf);
vty_out(vty, "Stalepath removal time: %d sec\n",
info->stale_removal_time);