I have some things here that do this, and it works fine for me:
require("http").get("http://192.168.1.101", function(res) {
console.log("Response: ",res);
if ("Date" in res.headers) {
console.log("Got Date ",res.headers.Date);
var date = new Date(res.headers.Date);
var d = date.getTime();
if (date.getMonth()>2/*Mar*/ && date.getMonth()<=9/*Oct*/)
d += 1000*3600; // 1 hour daylight saving
if (d>0) setTime(d/1000);
else console.log("Unable to parse date!");
}
});
It just pulls the date field right off the HTTP headers, so all you need is a standard HTTP server.
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 have some things here that do this, and it works fine for me:
It just pulls the date field right off the HTTP headers, so all you need is a standard HTTP server.