libmsc/msc_vty.c: print subscriber expiration time

Change-Id: I092691a8c443f4c5ed4d33de2e551fef592c1baf
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 8a976cb..c75cd0e 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -791,6 +791,8 @@
 static void vty_dump_one_subscr(struct vty *vty, struct vlr_subscr *vsub,
 				int offset, uint8_t dump_flags)
 {
+	struct gsm_network *net;
+	struct timespec now;
 	char buf[128];
 
 	if (vsub->name[0] != '\0') {
@@ -863,6 +865,21 @@
 			     VTY_NEWLINE);
 	}
 
+	/* XXX move t3212 into struct vlr_instance? */
+	net = vsub->vlr->user_ctx;
+	if (!net->t3212) {
+		MSC_VTY_DUMP(vty, offset, "Expires: never (T3212 is disabled)%s",
+			     VTY_NEWLINE);
+	} else if (vsub->expire_lu == VLR_SUBSCRIBER_NO_EXPIRATION) {
+		MSC_VTY_DUMP(vty, offset, "Expires: never%s",
+			     VTY_NEWLINE);
+	} else if (osmo_clock_gettime(CLOCK_MONOTONIC, &now) == 0) {
+		MSC_VTY_DUMP(vty, offset, "Expires: in %ld min %ld sec%s",
+			     (vsub->expire_lu - now.tv_sec) / 60,
+			     (vsub->expire_lu - now.tv_sec) % 60,
+			     VTY_NEWLINE);
+	}
+
 	MSC_VTY_DUMP(vty, offset, "Paging: %s paging for %d requests%s",
 		     vsub->cs.is_paging ? "is" : "not",
 		     llist_count(&vsub->cs.requests),