aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli-bearer.c
diff options
context:
space:
mode:
authorFrederic Martinsons <frederic.martinsons@sigfox.com>2021-10-15 08:38:50 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-10-22 13:48:13 +0200
commit0510e9aef8818eeaa445aea246b670871c671ddb (patch)
tree131380f2a6d70eeb880cbe9b216ef006b4eb1604 /cli/mmcli-bearer.c
parent53bcdaa8c3962abbf2a2f638c64173a7657ab560 (diff)
api,bearer: new 'start-date' field in bearer statistics
It stores the epoch timestamp of the current bearer session start. If there is no connected bearer, it is set to 0 and not displayed in mmcli output. Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com> Includes updates by Aleksander Morgado to fix coding style issues.
Diffstat (limited to 'cli/mmcli-bearer.c')
-rw-r--r--cli/mmcli-bearer.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c
index 54da4ff9..e9718e40 100644
--- a/cli/mmcli-bearer.c
+++ b/cli/mmcli-bearer.c
@@ -270,18 +270,21 @@ print_bearer_info (MMBearer *bearer)
/* Stats */
{
- gchar *duration = NULL;
- gchar *bytes_rx = NULL;
- gchar *bytes_tx = NULL;
- gchar *attempts = NULL;
- gchar *failed_attempts = NULL;
- gchar *total_duration = NULL;
- gchar *total_bytes_rx = NULL;
- gchar *total_bytes_tx = NULL;
+ guint64 start_date = 0;
+ gchar *duration = NULL;
+ gchar *bytes_rx = NULL;
+ gchar *bytes_tx = NULL;
+ gchar *attempts = NULL;
+ gchar *failed_attempts = NULL;
+ gchar *total_duration = NULL;
+ gchar *total_bytes_rx = NULL;
+ gchar *total_bytes_tx = NULL;
if (stats) {
guint64 val;
+ start_date = mm_bearer_stats_get_start_date (stats);
+
val = mm_bearer_stats_get_duration (stats);
if (val)
duration = g_strdup_printf ("%" G_GUINT64_FORMAT, val);
@@ -308,6 +311,8 @@ print_bearer_info (MMBearer *bearer)
total_bytes_tx = g_strdup_printf ("%" G_GUINT64_FORMAT, val);
}
+ if (start_date)
+ mmcli_output_start_date (start_date);
mmcli_output_string_take (MMC_F_BEARER_STATS_DURATION, duration);
mmcli_output_string_take (MMC_F_BEARER_STATS_BYTES_RX, bytes_rx);
mmcli_output_string_take (MMC_F_BEARER_STATS_BYTES_TX, bytes_tx);