summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-07-03 10:42:42 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-10 07:44:11 +0000
commit363130f3a19b6c7bfce7e694ea6167ed94834df5 (patch)
tree626d844eea776a958268c518c7fc748b48564f9a /src
parent5a54dcbc3879156485c28a2b79339b947fb50c61 (diff)
gsm_utils: Add osmo_dump_gsmtime
Used by osmo-bts, moved from osmo-bts l1sap.c:dump_gsmtime. Change-Id: Ib5452e2c20f53006c0f6d197fb055728947125d8
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsm_utils.c11
-rw-r--r--src/gsm/libosmogsm.map1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index 61d3f833..2c980d28 100644
--- a/src/gsm/gsm_utils.c
+++ b/src/gsm/gsm_utils.c
@@ -90,6 +90,7 @@
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
+#include <inttypes.h>
#include "../../config.h"
@@ -758,6 +759,16 @@ uint32_t gsm_gsmtime2fn(struct gsm_time *time)
return (51 * ((time->t3 - time->t2 + 26) % 26) + time->t3 + (26 * 51 * time->t1));
}
+char *osmo_dump_gsmtime(const struct gsm_time *tm)
+{
+ static char buf[64];
+
+ snprintf(buf, sizeof(buf), "%06"PRIu32"/%02"PRIu16"/%02"PRIu8"/%02"PRIu8"/%02"PRIu8,
+ tm->fn, tm->t1, tm->t2, tm->t3, (uint8_t)tm->fn%52);
+ buf[sizeof(buf)-1] = '\0';
+ return buf;
+}
+
/*! append range1024 encoded data to bit vector
* \param[out] bv Caller-provided output bit-vector
* \param[in] r Input Range1024 sructure */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index e992a4fc..ad7e0131 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -274,6 +274,7 @@ gsm_band_parse;
gsm_fn2gsmtime;
gsm_get_octet_len;
gsm_gsmtime2fn;
+osmo_dump_gsmtime;
gsm_milenage;
gsm_septet_encode;