diff --git a/sys/include/net/gnrc/gomach/types.h b/sys/include/net/gnrc/gomach/types.h index 8a0f0114d4..669ea6535b 100644 --- a/sys/include/net/gnrc/gomach/types.h +++ b/sys/include/net/gnrc/gomach/types.h @@ -297,14 +297,14 @@ typedef struct gomach { #if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1) /* Parameters for recording duty-cycle */ - uint64_t last_radio_on_time_ticks; /**< The last time in ticks - when radio is on */ - uint64_t radio_off_time_ticks; /**< The time in ticks when - radio is off */ - uint64_t system_start_time_ticks; /**< The time in ticks when - chip is started */ - uint64_t awake_duration_sum_ticks; /**< The sum of time in ticks - when radio is on */ + uint64_t last_radio_on_time_ms; /**< The last time in ms + when radio is on */ + uint64_t radio_off_time_ms; /**< The time in ms when + radio is off */ + uint64_t system_start_time_ms; /**< The time in ms when + chip is started */ + uint64_t awake_duration_sum_ms; /**< The sum of time in ms + when radio is on */ #endif } gnrc_gomach_t; diff --git a/sys/net/gnrc/link_layer/gomach/gomach.c b/sys/net/gnrc/link_layer/gomach/gomach.c index a3b6384b1f..fec23282f5 100644 --- a/sys/net/gnrc/link_layer/gomach/gomach.c +++ b/sys/net/gnrc/link_layer/gomach/gomach.c @@ -1991,8 +1991,8 @@ static void _gomach_msg_handler(gnrc_netif_t *netif, msg_t *msg) /* Output GoMacH's current radio duty-cycle. */ uint64_t duty; duty = xtimer_now_usec64(); - duty = (netif->mac.prot.gomach.awake_duration_sum_ticks) * 100 / - (duty - netif->mac.prot.gomach.system_start_time_ticks); + duty = (netif->mac.prot.gomach.awake_duration_sum_ms) * 100 / + (duty - netif->mac.prot.gomach.system_start_time_ms); printf("[GoMacH]: achieved radio duty-cycle: %lu %% \n", (uint32_t)duty); break; } @@ -2189,10 +2189,10 @@ static void _gomach_init(gnrc_netif_t *netif) #if (GNRC_MAC_ENABLE_DUTYCYCLE_RECORD == 1) /* Start duty cycle recording */ - netif->mac.prot.gomach.system_start_time_ticks = xtimer_now_usec64(); - netif->mac.prot.gomach.last_radio_on_time_ticks = - netif->mac.prot.gomach.system_start_time_ticks; - netif->mac.prot.gomach.awake_duration_sum_ticks = 0; + netif->mac.prot.gomach.system_start_time_ms = xtimer_now_usec64(); + netif->mac.prot.gomach.last_radio_on_time_ms = + netif->mac.prot.gomach.system_start_time_ms; + netif->mac.prot.gomach.awake_duration_sum_ms = 0; netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON; #endif diff --git a/sys/net/gnrc/link_layer/gomach/gomach_internal.c b/sys/net/gnrc/link_layer/gomach/gomach_internal.c index 3b66183245..d9bb9cb570 100644 --- a/sys/net/gnrc/link_layer/gomach/gomach_internal.c +++ b/sys/net/gnrc/link_layer/gomach/gomach_internal.c @@ -306,18 +306,18 @@ void gnrc_gomach_set_netdev_state(gnrc_netif_t *netif, netopt_state_t devstate) #if (GNRC_GOMACH_ENABLE_DUTYCYLE_RECORD == 1) if (devstate == NETOPT_STATE_IDLE) { if (!(netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON)) { - netif->mac.prot.gomach.last_radio_on_time_ticks = xtimer_now_usec64(); + netif->mac.prot.gomach.last_radio_on_time_ms = xtimer_now_usec64(); netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON; } return; } else if ((devstate == NETOPT_STATE_SLEEP) && (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON)) { - netif->mac.prot.gomach.radio_off_time_ticks = xtimer_now_usec64(); + netif->mac.prot.gomach.radio_off_time_ms = xtimer_now_usec64(); - netif->mac.prot.gomach.awake_duration_sum_ticks += - (netif->mac.prot.gomach.radio_off_time_ticks - - netif->mac.prot.gomach.last_radio_on_time_ticks); + netif->mac.prot.gomach.awake_duration_sum_ms += + (netif->mac.prot.gomach.radio_off_time_ms - + netif->mac.prot.gomach.last_radio_on_time_ms); netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON; }