Unexpected behaviour from sntp library
Posted: Thu Mar 25, 2021 3:08 pm
Hi all
I was testing sntp time synchronization on multiple esp32s and noticed small time difference on all.
It got worse, when network quality went down.
Started looking into it and in the 48 byte request packet sent out, only the first byte has value 0x23, rest 0x00.
Essentially missing the "origin timestamp", t0. Therefore making it not very accurate, unless the library has it's own system keeping timestamps of packets sent out?
From wiki
Round trip calculation for delay.
t0 is the client's timestamp of the request packet transmission,
t1 is the server's timestamp of the request packet reception,
t2 is the server's timestamp of the response packet transmission and
t3 is the client's timestamp of the response packet reception.
library used:
esp_sntp.h
https://docs.espressif.com/projects/esp ... ronization
There should be case when t0 is set to 0 when, time has not been synced before, but seems it's always 0s.
Can anyone else confirm this or is this expected?
I was testing sntp time synchronization on multiple esp32s and noticed small time difference on all.
It got worse, when network quality went down.
Started looking into it and in the 48 byte request packet sent out, only the first byte has value 0x23, rest 0x00.
Essentially missing the "origin timestamp", t0. Therefore making it not very accurate, unless the library has it's own system keeping timestamps of packets sent out?
From wiki
Round trip calculation for delay.
t0 is the client's timestamp of the request packet transmission,
t1 is the server's timestamp of the request packet reception,
t2 is the server's timestamp of the response packet transmission and
t3 is the client's timestamp of the response packet reception.
library used:
esp_sntp.h
https://docs.espressif.com/projects/esp ... ronization
There should be case when t0 is set to 0 when, time has not been synced before, but seems it's always 0s.
Can anyone else confirm this or is this expected?