Closed m-kozlowski closed 2 years ago
after setting
ntpUpdateIntvl => "10000"
it syncs every 15-16 seconds
thx! these should've been wrapped with milliseconds
https://github.com/xoseperez/espurna/blob/26d28db0ef8be719a296a81dcaa6094e6c5cc67c/code/espurna/ntp.cpp#L60
https://github.com/xoseperez/espurna/blob/26d28db0ef8be719a296a81dcaa6094e6c5cc67c/code/espurna/ntp.cpp#L65
(i.e. instead of value.count()
-> espurna::duration::Milliseconds(value).count()
, these are going into the sntp that only understand milliseconds)
it is also interesting that sntp does not actually enforce time limits mentioned in the func signature, I should've probably added a clamp() right when the value is randomized...
Too elegant, I'd just go with *1000L ;p But your way also works;)
diff --git a/code/espurna/ntp.cpp b/code/espurna/ntp.cpp
index e31b3e5e..f7822a1d 100644
--- a/code/espurna/ntp.cpp
+++ b/code/espurna/ntp.cpp
@@ -57,12 +57,12 @@ espurna::duration::Seconds _ntpRandomizeDelay(espurna::duration::Seconds base) {
uint32_t sntp_startup_delay_MS_rfc_not_less_than_60000() {
static_assert(sizeof(decltype(_ntp_startup_delay)::rep) <= sizeof(uint32_t), "");
- return _ntp_startup_delay.count();
+ return espurna::duration::Milliseconds(_ntp_startup_delay).count();
}
uint32_t sntp_update_delay_MS_rfc_not_less_than_15000() {
static_assert(sizeof(decltype(_ntp_update_delay)::rep) <= sizeof(uint32_t), "");
- return _ntp_update_delay.count();
+ return espurna::duration::Milliseconds(_ntp_update_delay).count();
}
// We also must shim TimeLib functions until everything else is ported.
Bug description Just noticed this in debug tab:
Steps to reproduce current master (26d28db0ef8be719a296a81dcaa6094e6c5cc67c) ntpUpdateIntvl not set, so it should be at default 1800
Device information
Tools used