Query API, time.unix and daylight savings time

time.unix is supposed to give me an epoch time stamp. Epoch is always supposed to be UTC time zone. But I’ve got daylight savings time set, and time.unix is giving me an epoch time 1 hour in the future (considered from UTC)?

While it’s true that the strict definition of UNIXtime is seconds since 1/1/1970 UTC time, that is also true of the ISO format which requires a local time offset be appended when expressing local time. This is a problem with spreadsheets as some do not recognize the local time variant.

One of the uses of query output is to extract data for speadsheets. So when local time is called for, it returns the local time as if it were UTC. This is contrary to the specification, which calls for UTC time with the local time suffix appended. In the interest of consistency, UNIX time is handled the same way. The value is offset by the local time when local is requested.

Within the strict definition of both ISO and UNIX formats, there is no local time variant. So in order to provide a local option, both formats are adjusted to be based off of the local time as set in the IoTaWatt at the time of the query.

I don’t think that is a huge problem. It probably could be documented better and maybe I will do that. The real issue here I think is that .local is the default where having it be the exception might be clearer. In any event that would be a breaking change now, so we have to live with it.

If you simply specify time.utc.unix you will get what you expect.