and so the ‘testvalue’ calculates properly as floating point but only if you don’t accidentally convert it to an integer. (add “.0” to the end of values)
I don’t know how many digits of precision are allowed or determined in floating point.
That is a 64-bit real time in milliseconds. There is no Squirrel datatype that can hold a 64-bit integer, so no function can return 1419634619222. However, if you don’t mind only getting the answer to the nearest second, and if you know that the answer is within about 2 million seconds (two billion milliseconds, or 49 days) of the current time, you can round it:
`local function round64bittime(t)
{
local now = time();
local t2 = now1000;
local diff = (t-t2)/1000;
if (diff > 210001000) {
diff -= 4294967; // this constant is (2**32)/1000
} else if (diff < -21000*1000) {
diff += 4294967;
}
return now + diff;
}
local body = “{“updated”: 1419634619222}”;
local data = http.jsondecode(body);
server.log(data.updated);
server.log(round64bittime(data.updated));`