Best way to guarantee times when using BULK load with PHPTIMESERIES?

Unfortunately there is no “absolute timestamp” bulk api, I started looking into this a while back as I was seeing some unusual timestamps logged,

Firstly as you are using “offset=” the “time=” doesn’t get a look in as the offset option is before the time option in the bulk input api’s if else block.

As far as I could make out the only way you might be able to coerce emoncms to use the supplied timestamp is to use time=0, that way the calculated $time_ref is zero and there should be no “adjustment” made when each individual frames timestamp is processed further along the code.

All the other options “sentat=”, “offset=” or even legacy mode (by omitting an overall timestamp mode) use the timestamp of the server to establish a $time_ref, so time difference between the machines and even time in transit could skew the timestamps.

So try (reusing your example)

http…&data=[…[1480115210,21,21337],[1480115260,21,21337],[1480115270,21,20958],[1480115310,21,20958],[1480115320,21,21146],[1480115360,21,21146]]&time=0

Also bear in mind that because the input api uses (int)$itemtime the timestamp gets truncated to the whole second, not rounded so 1480115210.999 would become 1480115210 not 1480115211.

and please let us know how you get on.

1 Like