Skip to content

Commit 516df5c

Browse files
committed
gnrc/gnrc_netif_hdr_print: printout timestamp if enabled
Signed-off-by: chudov <[email protected]>
1 parent 2863dc9 commit 516df5c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

sys/net/gnrc/netif/hdr/gnrc_netif_hdr_print.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ void gnrc_netif_hdr_print(gnrc_netif_hdr_t *hdr)
2424

2525
printf("if_pid: %u ", (unsigned) hdr->if_pid);
2626
printf("rssi: %d ", (signed) hdr->rssi);
27+
#if IS_USED(MODULE_GNRC_NETIF_TIMESTAMP)
28+
/* Only last 32 bits are printed due to printf from avg-libc doesn't support 64-bit values */
29+
printf(" timestamp: %" PRIu32 ".%09" PRIu32 " ", (uint32_t)(hdr->timestamp / NS_PER_SEC),
30+
(uint32_t)(hdr->timestamp % NS_PER_SEC));
31+
#endif
2732
printf("lqi: %u\n", (unsigned) hdr->lqi);
2833
printf("flags: ");
2934

tests/net/gnrc_netif/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ USEMODULE += netdev_ieee802154
1111
USEMODULE += netdev_test
1212
USEMODULE += od
1313

14+
# uncomment the line to have and see timestamp in the netif header
15+
#USEMODULE += gnrc_netif_timestamp
16+
1417
# deactivate automatically emitted packets from IPv6 neighbor discovery
1518
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ARSM=0
1619
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_SLAAC=0

0 commit comments

Comments
 (0)