e1cap_dump: Print human-readable time
diff --git a/src/e1cap_dump.c b/src/e1cap_dump.c
index 3e91191..03b86f7 100644
--- a/src/e1cap_dump.c
+++ b/src/e1cap_dump.c
@@ -1,4 +1,6 @@
 #include <stdio.h>
+#include <time.h>
+
 #include <sys/time.h>
 
 #include <osmocom/core/signal.h>
@@ -10,6 +12,20 @@
 
 struct e1_recorder g_recorder;
 
+static char *timeval2str(struct timeval *tv)
+{
+	time_t nowtime;
+	struct tm *nowtm;
+	char tmbuf[64];
+	static char buf[64];
+
+	nowtime = tv->tv_sec;
+	nowtm = localtime(&nowtime);
+	strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", nowtm);
+	snprintf(buf, sizeof buf, "%s.%06ld", tmbuf, tv->tv_usec);
+	return buf;
+}
+
 int main(int argc, char **argv)
 {
 	struct osmo_e1cap_file *f;
@@ -26,8 +42,8 @@
 		exit(1);
 
 	while ((pkt = osmo_e1cap_read_next(f))) {
-		printf("%lu:%lu %02u/%02u %u (%u): %s\n",
-			pkt->ts.tv_sec, pkt->ts.tv_usec,
+		printf("%s %02u/%02u %u (%u): %s\n",
+			timeval2str(&pkt->ts),
 			pkt->line_nr, pkt->ts_nr, pkt->capture_mode,
 			pkt->len,
 			osmo_hexdump_nospc(pkt->data, pkt->len));