Change in osmo-e1-recorder[master]: fix recording of timestamp and make e1cap format portable

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Nov 24 17:06:42 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16186 )


Change subject: fix recording of timestamp and make e1cap format portable
......................................................................

fix recording of timestamp and make e1cap format portable

The original format included a 'struct timeval' into the packet header,
which unfortunately is non-potrable between e.g. i386 and amd64.

Furthermore, the code acutally writing the timveal into the header
was broken, resulting in invalid timestamps in all e1cap taken so far.

Change-Id: I0d22ad8f772d173c2252c2f6c562faee2e578806
---
M src/e1cap_dump.c
M src/storage.c
M src/storage.h
3 files changed, 8 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1-recorder refs/changes/86/16186/1

diff --git a/src/e1cap_dump.c b/src/e1cap_dump.c
index 232769c..027aa82 100644
--- a/src/e1cap_dump.c
+++ b/src/e1cap_dump.c
@@ -174,7 +174,8 @@
 
 	switch (g_mode) {
 	case MODE_PRINT:
-		tv = pkt->ts;
+		tv.tv_sec = pkt->ts.tv_sec;
+		tv.tv_usec = pkt->ts.tv_usec;
 		printf("%s %02u/%02u %u (%u): %s\n",
 			timeval2str(&tv),
 			pkt->line_nr, pkt->ts_nr, pkt->capture_mode,
diff --git a/src/storage.c b/src/storage.c
index ddbadd0..a084535 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -79,8 +79,9 @@
 	};
 
 	h->len = htonl(msg->len);
-	tv = h->ts;
 	gettimeofday(&tv, NULL);
+	h->ts.tv_sec = tv.tv_sec;
+	h->ts.tv_usec = tv.tv_usec;
 	h->line_nr = ts->line->num;
 	h->ts_nr = ts->num;
 	h->capture_mode = mode;
diff --git a/src/storage.h b/src/storage.h
index c7c1890..0ea9937 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -11,7 +11,10 @@
 /* header for each frame we store */
 struct osmo_e1cap_pkthdr {
 	/* Timestamp at which frame was received */
-	struct timeval ts;
+	struct {
+		uint32_t tv_sec;
+		uint32_t tv_usec;
+	} ts;
 	/* length of frame data after this header */
 	uint32_t len;
 	/* line/span number on which frame was received */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-e1-recorder/+/16186
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1-recorder
Gerrit-Branch: master
Gerrit-Change-Id: I0d22ad8f772d173c2252c2f6c562faee2e578806
Gerrit-Change-Number: 16186
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191124/02d49693/attachment.htm>


More information about the gerrit-log mailing list