Time on Espruino on ESP32

Espruino devices do not usually have a proper battery-backed RTC available, so the second easiest way to get a time is via (S)NTP. On Espruino on the ESP8266 this is super-simple ( is my NTP time server and 9 is the timezone offset):

//Wifi.setSNTP("", 9);

but that does not work on Espruino on the ESP32 as Wifi.setSNTP() does not exist here (nor anywhere else). But a module for SNTP exists. This is how to use it to set the time:

// ESP32
const sntp=require('sntp');
var options = {
    host: '',
    port: 123,
    timeout: 1000

sntp.time(options, function (err, time) {
    if (err) {
        console.log('Failed: ' + err.message);
    //console.log('Local clock is off by: ' + time.t + ' milliseconds');
    //console.log('Full NtpMessage:', time);

Way more complicated, but it's more general on Espruino.