From 8fb1c09df1540aa3fca1148bed6a08ffc3090669 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Tue, 27 Oct 2026 19:15:22 +0100 Subject: All OSes now do have a cheap monotonic clock, so no caching thread is needed. Also add some relative time helpers --- ot_udp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ot_udp.c') diff --git a/ot_udp.c b/ot_udp.c index 4e760bb..19a6c7c 100644 --- a/ot_udp.c +++ b/ot_udp.c @@ -30,7 +30,7 @@ static void udp_generate_rijndael_round_key(void) { rijndaelKeySetupEnc128(g_rijndael_round_key, (uint8_t *)key); g_key_of_the_hour[0] = random_uint32(); - g_hour_of_the_key = g_now_minutes; + g_hour_of_the_key = time_now_minutes(); } /* Generate current and previous connection id for ip */ @@ -39,14 +39,14 @@ static void udp_make_connectionid(uint32_t connid[2], const ot_ip6 remoteip, int int i; uint32_t current_key_of_the_hour; - if (g_now_minutes - g_hour_of_the_key >= 60) { + if (time_now_minutes() - g_hour_of_the_key >= 60) { uint32_t old_key_of_the_hour = g_key_of_the_hour[0]; uint32_t new_key_of_the_hour = random_uint32(); /* If in the meantime another thread has performed key rotation, do not overwrite their results */ - if (g_now_minutes - g_hour_of_the_key >= 60) { + if (time_now_minutes() - g_hour_of_the_key >= 60) { /* Upgrade en bloc */ - g_hour_of_the_key = g_now_minutes; + g_hour_of_the_key = time_now_minutes(); g_key_of_the_hour[0] = new_key_of_the_hour; g_key_of_the_hour[1] = old_key_of_the_hour; } -- cgit v1.3