summaryrefslogtreecommitdiffstats
path: root/isisd/isis_misc.c
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2017-08-03 11:45:58 +0200
committerChristian Franke <chris@opensourcerouting.org>2017-08-03 11:45:58 +0200
commit02cd317ea0cc7d39ff7ae121468c9cd68a24f9ae (patch)
tree6ca76fd27fec008166d9e9cee06f71e39de33117 /isisd/isis_misc.c
parentisisd: purge LSP correctly on confusion (diff)
downloadfrr-02cd317ea0cc7d39ff7ae121468c9cd68a24f9ae.tar.xz
frr-02cd317ea0cc7d39ff7ae121468c9cd68a24f9ae.zip
isisd: make isis_spftree non-public
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_misc.c')
-rw-r--r--isisd/isis_misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index 4d7b4c381..c872774da 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -601,3 +601,24 @@ void vty_multiline(struct vty *vty, const char *prefix, const char *format, ...)
XFREE(MTYPE_TMP, p);
}
+
+void vty_out_timestr(struct vty *vty, time_t uptime)
+{
+ struct tm *tm;
+ time_t difftime = time(NULL);
+ difftime -= uptime;
+ tm = gmtime(&difftime);
+
+#define ONE_DAY_SECOND 60*60*24
+#define ONE_WEEK_SECOND 60*60*24*7
+ 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");
+}