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?
Unexpected behaviour from sntp library
Re: Unexpected behaviour from sntp library
I see, thanks for the direction!
There might be an easier way to do this:
to
in https://github.com/espressif/esp-lwip/b ... h#L96-L136
in order to get origin timestamps moving.
Slightly more difficult in Arduino world, where basically liblwip.a needs recompiling.
There might be an easier way to do this:
Code: Select all
#define SNTP_CHECK_RESPONSE 0
#define SNTP_COMP_ROUNDTRIP 0
Code: Select all
#define SNTP_CHECK_RESPONSE 2
#define SNTP_COMP_ROUNDTRIP 1
in order to get origin timestamps moving.
Slightly more difficult in Arduino world, where basically liblwip.a needs recompiling.
Re: Unexpected behaviour from sntp library
Yes you're right I think probably here https://github.com/espressif/esp-idf/bl ... ts.h#L1007
Who is online
Users browsing this forum: No registered users and 75 guests