Time Servers

Anyone tried accessing NTP time servers through Agent code? I don’t seem to be having much success, but I’d like to be able to query a server with http.post or http.get, and get something back I can parse and transfer to the Device.

The results of Squirrel’s time() and date(), in agents, comes from our cloud servers’ own clocks, which themselves are synchronised using NTP. Note that, as an extension to upstream Squirrel’s version of date(), in agents the returned structure has two additional fields: “time” containing the Unix time in integer seconds since 1970-Jan-01, and “usec” containing the fractional part of the Unix time in microseconds. Armed with these, you probably don’t need to access an NTP time server yourself.


Thanks, Peter.

Now if that had been in the Squirrel Ref Manual, I wouldn’t have needed to ask. I’ll make sure it’s in ours, but I wonder what else me and others are missing.