From 516df5cdb6247bb040ebdee66c8c8ec1363aedac Mon Sep 17 00:00:00 2001 From: chudov Date: Thu, 11 May 2023 16:41:53 +0200 Subject: [PATCH] gnrc/gnrc_netif_hdr_print: printout timestamp if enabled Signed-off-by: chudov --- sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c | 5 +++++ tests/net/gnrc_netif/Makefile | 3 +++ 2 files changed, 8 insertions(+) diff --git a/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c b/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c index fa382fd935..64c72bff8b 100644 --- a/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c +++ b/sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c @@ -24,6 +24,11 @@ void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr) printf("if_pid: %u ", (unsigned) hdr->if_pid); printf("rssi: %d ", (signed) hdr->rssi); +#if IS_USED(MODULE_GNRC_NETIF_TIMESTAMP) + /* Only last 32 bits are printed due to printf from avg-libc doesn't support 64-bit values */ + printf(" timestamp: %" PRIu32 ".%09" PRIu32 " ", (uint32_t)(hdr->timestamp / NS_PER_SEC), + (uint32_t)(hdr->timestamp % NS_PER_SEC)); +#endif printf("lqi: %u\n", (unsigned) hdr->lqi); printf("flags: "); diff --git a/tests/net/gnrc_netif/Makefile b/tests/net/gnrc_netif/Makefile index 537b906a9c..60607b8ad3 100644 --- a/tests/net/gnrc_netif/Makefile +++ b/tests/net/gnrc_netif/Makefile @@ -11,6 +11,9 @@ USEMODULE += netdev_ieee802154 USEMODULE += netdev_test USEMODULE += od +# uncomment the line to have and see timestamp in the netif header +#USEMODULE += gnrc_netif_timestamp + # deactivate automatically emitted packets from IPv6 neighbor discovery CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ARSM=0 CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=0