From f48e1c205af3d2b3d0a35615ed5ba6fa2b280241 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Fri, 10 Oct 2025 22:57:08 +0200 Subject: [PATCH] odhcdp: use a more suitable clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In my testing, CLOCK_MONOTONIC_COARSE uses about 1/3 of the CPU cycles. And the accuracy is completely irrelevant. Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/282 Signed-off-by: Álvaro Fernández Rojas --- src/odhcpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/odhcpd.c b/src/odhcpd.c index 4b17a16..ef67acc 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -551,7 +551,7 @@ int odhcpd_urandom(void *data, size_t len) time_t odhcpd_time(void) { struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_MONOTONIC_COARSE, &ts); return ts.tv_sec; } -- 2.30.2