I've found bug in setSNTP implementation. Now I have simple example. Also I think I know reason.
var wifi=require("Wifi");
var i1=setInterval(()=>console.log(1),2000);
var i2=setInterval(()=>console.log(2),3333);
setTimeout(()=>{
wifi.setSNTP('pool.ntp.org','0');
},7000);
After setSNTP call both intervals works as if they are with zero delay.
I think it happens because SNTP subsystem uses settimeofday() inside by default and so does not change interval times.
It is possible to redefine SNTP_SET_SYSTEM_TIME macro to call jshSetSystemTime() instead of settimeofday(). I think it will repair the bug. I think also lwipopts.h is good place for it.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I've found bug in setSNTP implementation. Now I have simple example. Also I think I know reason.
After setSNTP call both intervals works as if they are with zero delay.
I think it happens because SNTP subsystem uses settimeofday() inside by default and so does not change interval times.
It is possible to redefine SNTP_SET_SYSTEM_TIME macro to call jshSetSystemTime() instead of settimeofday(). I think it will repair the bug. I think also lwipopts.h is good place for it.