aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2019-11-25 13:28:23 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2019-12-16 17:17:58 +0100
commitf6d457e7ef52a8ee24f92e4cce9dca0209e7ddb2 (patch)
tree7772ad7ba175fde72c7ddc2dd897c856033282d2
parentfa287c579cff46f363ca7a946aaf4e73b87b60b5 (diff)
hlr_vty_subscr: prettier output for last LU seen
Extend the "last LU seen on ..." line with the amount of seconds that passed since now, or "(invalid timestamp)". Patch split from Id7fc50567211a0870ac0524f6dee94d4513781ba, because it depends on timestamp_age which was just added in Ife4a61d71926d08f310a1aeed9d9f1974f64178b. Change-Id: I24f9e86c1aa0b1576290094e024562f41b988f37
-rw-r--r--src/hlr_vty_subscr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c
index b561636..14a37f2 100644
--- a/src/hlr_vty_subscr.c
+++ b/src/hlr_vty_subscr.c
@@ -30,6 +30,7 @@
#include <osmocom/hlr/hlr.h>
#include <osmocom/hlr/db.h>
+#include <osmocom/hlr/timestamp.h>
struct vty;
@@ -49,11 +50,15 @@ get_datestr(const time_t *t, char *datebuf)
static void dump_last_lu_seen(struct vty *vty, const char *domain_label, time_t last_lu_seen)
{
+ uint32_t age;
char datebuf[26]; /* for ctime_r(3) */
if (!last_lu_seen)
return;
- vty_out(vty, " last LU seen on %s: %s UTC%s", domain_label, get_datestr(&last_lu_seen, datebuf),
- VTY_NEWLINE);
+ vty_out(vty, " last LU seen on %s: %s UTC", domain_label, get_datestr(&last_lu_seen, datebuf));
+ if (!timestamp_age(&last_lu_seen, &age))
+ vty_out(vty, " (invalid timestamp)%s", VTY_NEWLINE);
+ else
+ vty_out(vty, " (%us ago)%s", age, VTY_NEWLINE);
}
static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)