aboutsummaryrefslogtreecommitdiffstats
path: root/src/libbsc/bsc_vty.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-10-10 14:50:35 +0200
committerHarald Welte <laforge@gnumonks.org>2017-10-11 01:28:10 +0000
commit25cc407c5be8d3f130886353bf49836d19bebfe2 (patch)
tree512bbcc0bde7f27e42857616a7870d69b117fad6 /src/libbsc/bsc_vty.c
parente1ceb6f76740c12bc8529e0329dfc9dbf515fb3a (diff)
ctrl: add oml-uptime command
Expose OML link uptime available via vts's "sh bts 0" command with the new "bts.0.oml-uptime" ctrl command. To avoid code duplication, move uptime computation into separate function and use it for both. Change-Id: Iec405aa949d6a38a9c8e64cd7ee4b49fd416835d Related: OS#2486
Diffstat (limited to 'src/libbsc/bsc_vty.c')
-rw-r--r--src/libbsc/bsc_vty.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 43cb282a4..ca29b4c31 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -236,8 +236,6 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
{
struct pchan_load pl;
unsigned long long sec;
- struct timespec tp;
- int rc;
vty_out(vty, "BTS %u is of %s type in band %s, has CI %u LAC %u, "
"BSIC %u (NCC=%u, BCC=%u) and %u TRX%s",
@@ -309,17 +307,11 @@ static void bts_dump_vty(struct vty *vty, struct gsm_bts *bts)
bts->paging.available_slots, VTY_NEWLINE);
if (is_ipaccess_bts(bts)) {
vty_out(vty, " OML Link state: %s", get_model_oml_status(bts));
- if (bts->oml_link) {
- if (bts->uptime) {
- rc = clock_gettime(CLOCK_MONOTONIC, &tp);
- if (rc == 0) { /* monotonic clock helps to ensure that conversion below is valid */
- sec = (unsigned long long)difftime(tp.tv_sec, bts->uptime);
- vty_out(vty, " %llu days %llu hours %llu min. %llu sec.%s",
- OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), OSMO_SEC2MIN(sec),
- sec % 60, VTY_NEWLINE);
- }
- }
- }
+ sec = bts_uptime(bts);
+ if (sec)
+ vty_out(vty, " %llu days %llu hours %llu min. %llu sec.%s",
+ OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), OSMO_SEC2MIN(sec), sec % 60,
+ VTY_NEWLINE);
} else {
vty_out(vty, " E1 Signalling Link:%s", VTY_NEWLINE);
e1isl_dump_vty(vty, bts->oml_link);