linkedfactory / specification

Documentation of the LinkedFactory data formats and APIs.
0 stars 0 forks source link

Time stamp format #13

Open SimonStier opened 2 weeks ago

SimonStier commented 2 weeks ago

Examples like

{ "value": 20.4, "time": 1619424246120 }

imply that timestamps are Unix timestamps. Regarding the limitations (absolute range, sub-millisecond resolution) - is ISO 8601 (e.g. 2021-04-26T08:04:06.120Z also supported?

kenwenzel commented 2 weeks ago

Timestamps are actually just positive integer values without any specific resolution but it is expected that they are interpreted as Unix timestamps in milliseconds resolution. For example, the Grafana datasource is relying on this interpretation. In the context of manufacturing timestamps are often just numbers and that is one of the main reasons why the current format just uses positive integers.

It could be possible to support something like

{ "value": 20.4, "isoTime": "2021-04-26T08:04:06.120Z" }

I am not yet sure how this could safely interoperate with the current numeric representation. It seems that IoTDB also supports some mixture of LONG and DATETIME: https://iotdb.apache.org/UserGuide/V1.2.x/Basic-Concept/Data-Type.html#absolute-timestamp

kenwenzel commented 2 weeks ago

The SQLite implementation of timestamps could also be relevant: https://www.sqlite.org/datatype3.html#date_and_time_datatype