pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-cbc/+/28785 )
Change subject: vty: Print created and expired times for each message
......................................................................
vty: Print created and expired times for each message
This also allows differentiating between expired and active
messages.
Change-Id: I9ee49b99546a44be706700c3db94d45210c47e54
---
M src/cbc_vty.c
1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-cbc refs/changes/85/28785/1
diff --git a/src/cbc_vty.c b/src/cbc_vty.c
index 7e5a9db..2b21c53 100644
--- a/src/cbc_vty.c
+++ b/src/cbc_vty.c
@@ -102,13 +102,26 @@
static void dump_one_cbc_msg(struct vty *vty, const struct cbc_message *cbc_msg)
{
const struct smscb_message *smscb = &cbc_msg->msg;
+ char str_created[32], str_expired[32];
+ struct tm tm_created = {0};
+ struct tm tm_expired = {0};
+
+ localtime_r(&cbc_msg->time.created, &tm_created);
+ strftime(str_created, sizeof(str_created), "%Y-%m-%dT%H:%M:%SZ",
&tm_created);
+ if (cbc_msg->time.expired > 0) {
+ localtime_r(&cbc_msg->time.expired, &tm_expired);
+ strftime(str_expired, sizeof(str_expired), "%Y-%m-%dT%H:%M:%SZ",
&tm_expired);
+ } else {
+ OSMO_STRLCPY_ARRAY(str_expired, "active");
+ }
OSMO_ASSERT(!smscb->is_etws);
- vty_out(vty, "| %04X| %04X|%-20s|%-13s| %-4u|%c| %02x|%s",
+ vty_out(vty, "| %04X| %04X|%-20s|%-13s| %-4u|%c| %02x|%-28s|%-28s|%s",
smscb->message_id, smscb->serial_nr, cbc_msg->cbe_name,
get_value_string(cbsp_category_names, cbc_msg->priority), cbc_msg->rep_period,
cbc_msg->extended_cbch ? 'E' : 'N', smscb->cbs.dcs,
+ str_created, str_expired,
VTY_NEWLINE);
}
@@ -119,7 +132,7 @@
struct cbc_message *cbc_msg;
vty_out(vty,
-"|MsgId|SerNo| CBE Name | Category |Period|E|DCS|%s",
VTY_NEWLINE);
+"|MsgId|SerNo| CBE Name | Category |Period|E|DCS| Created
| Expired |%s", VTY_NEWLINE);
vty_out(vty,
"|-----|-----|--------------------|-------------|------|-|---|%s",
VTY_NEWLINE);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-cbc/+/28785
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I9ee49b99546a44be706700c3db94d45210c47e54
Gerrit-Change-Number: 28785
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange