knezzz/ntp

Large offset on the first getNtpOffset call

gapspt opened this issue · 1 comments

For a device that is time synchronized, the first time the getNtpOffset is called it yields a large offset (usually around 2 seconds) but on subsequent calls it will give a more realistic value (around 50 milliseconds).
This is probably due to the initialization phase (either the sockets that the plugin uses need some warming up, or the actual application starting up is taking too many resources).

This problem could be minimized if the localTime ?? DateTime.now() would be postponed to as late as possible, as well as the creation of the _NTPMessage.

Fixed with #18