From f83efda54e7809a5bf5351f820757417e0346aa3 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 20 Jul 2026 01:07:09 +0300 Subject: [PATCH] =?UTF-8?q?ntp=5Fnode=5Ftime:=20=D0=B8=D1=81=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B7=D0=BD=D0=B0=D0=BA=20off?= =?UTF-8?q?set=20=E2=80=94=20=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=88=D0=BB=D0=B0=20?= =?UTF-8?q?=D0=B2=20=D0=BE=D0=B1=D1=80=D0=B0=D1=82=D0=BD=D1=83=D1=8E=20?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D1=80=D0=BE=D0=BD=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ntp_time_get_us() вычитает offset (local_us - offset_us), поэтому offset_us должен быть local_raw - peer_time, а не наоборот. Было peer_time - local_raw → corrected = 2*local - peer (ошибка). Стало local_raw - peer_time → corrected = peer_time (верно). --- src/ntp_node_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ntp_node_time.c b/src/ntp_node_time.c index 720ae3a3..e22f30b7 100644 --- a/src/ntp_node_time.c +++ b/src/ntp_node_time.c @@ -148,7 +148,7 @@ static void ntp_node_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entry) { int was_unsynced = !ntp_time_is_synced(inst); if (was_unsynced && sender_synced) { - inst->ntp.offset_us = msg->t_sender_us - t4; + inst->ntp.offset_us = t4 - msg->t_sender_us; inst->ntp.synced = 1; inst->ntp.last_sync_tb = get_time_tb();