Influxdb in node time precision

Version [V1.x]. At "influxdb in" node, the default time precision is "ms".
In the advanced query option of the "influxdb in" node, changed the time precision to "Microsecond (u)", but the query result is still showing "Millisecond (ms)" resolution in the debug window of node-RED. Also when using function node to handle the output from the node, the precision is also "ms".

"Raw output" from the "influxdb in" node gives higher timing resolution.
Is this a bug from the node?


Here is the screen shot of the raw output from the "influxdb in" node.
The debug window can display higher time precision. So it should be the "influxdb in" node issue. Its time precision does not work.

What value is given if you click in the debug window on the date/time string?
When clicking on it it will give you the timestamp.

1 Like

Solved the problem with the following approach:

  1. Read out the first data in millisecond resolution, then calculating the time passed for the remaining samples using microseconds based on the sampling rate. Use this new time stamps with microseconds resolution.
  2. Convert the time stamp (number) to strings, and use strings instead of time stamps for the Plotly chart x-axis time input (The Plotly charts only have millisecond resolution too :rofl:).
  3. Format the chart x-axis ticks to display like date/time nicely

@edje11 The Influxdb in node read out is a string (We saved the timestamp with mciro seconds resolution with "microtime" function at influxdb out node.) Querying the database in command line shows correct time stamps.

I know you have solved your problem, but I've been working with the influx package (which is used by the Influx Nodes) on a current project.

For the time field it returns objects of a custom Date class (NanoDate) with additional methods providing access to the higher resolution timestamps returned by Influx.

So I think the output you see in the debug panel is just a toString() representation of that NanoDate object in standard ISO 8601 notation (milliseconds).

Here's an excerpt of the output I get via console.dir() for the time field:

time: 2022-06-27T11:30:42.546Z {
      _nanoISO: '2022-06-27T11:30:42.546Z',
      getNanoTime: [Function: getNanoTimeFromISO],
      toNanoISOString: [Function: toNanoISOStringFromISO]

I hope that info is helpful, maybe you can simplify some things. :slightly_smiling_face:

Thanks much Kuema.

This is good to know. I will look into this when time allows. Yes this indeed could simply things.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.