summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_misc.c18
-rw-r--r--isisd/isis_vty_fabricd.c16
2 files changed, 8 insertions, 26 deletions
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index 5fa33f550..96b76da92 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -562,20 +562,12 @@ void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...)
void vty_out_timestr(struct vty *vty, time_t uptime)
{
- struct tm tm;
time_t difftime = time(NULL);
+ char buf[MONOTIME_STRLEN];
+
difftime -= uptime;
- gmtime_r(&difftime, &tm);
-
- if (difftime < ONE_DAY_SECOND)
- vty_out(vty, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
- tm.tm_sec);
- else if (difftime < 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");
+ frrtime_to_interval(difftime, buf, sizeof(buf));
+
+ vty_out(vty, "%s ago", buf);
}
diff --git a/isisd/isis_vty_fabricd.c b/isisd/isis_vty_fabricd.c
index 88f7337a9..09b8d2825 100644
--- a/isisd/isis_vty_fabricd.c
+++ b/isisd/isis_vty_fabricd.c
@@ -115,6 +115,7 @@ DEFUN (no_triggered_csnp,
static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp)
{
char lspid[255];
+ char buf[MONOTIME_STRLEN];
lspid_print(lsp->hdr.lsp_id, lspid, true, true);
vty_out(vty, "Flooding information for %s\n", lspid);
@@ -129,21 +130,10 @@ static void lsp_print_flooding(struct vty *vty, struct isis_lsp *lsp)
lsp->flooding_interface : "(null)");
time_t uptime = time(NULL) - lsp->flooding_time;
- struct tm tm;
- gmtime_r(&uptime, &tm);
+ frrtime_to_interval(uptime, buf, sizeof(buf));
- 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");
+ vty_out(vty, "%s ago)\n", buf);
if (lsp->flooding_circuit_scoped) {
vty_out(vty, " Received as circuit-scoped LSP, so not "