Mathematical Operations on Timestamps?

Hi!

I would like to know if it is possible to do mathematical operations on timestamps?

Right now, i know i can do it on (for example : sensors) values, but i didn’t found anything about the timestamps.

An example would be to search for a particular timestamp and calculate the time difference between now and then.

Another one would be to know the time of some process and then make a sum with the different process times.

Another one could be to divide the time of a process by units made.

But yeah, what i want is to use the timestamps associated to a value and not the value associated to the timestamp. I hope its a bit clear haha

P.S. English is not my first language, if you have any questions because what i wrote is not clear, it will be a pleasure to answer!

Take a look at function ELAPSED(). It’s not exactly what you are asking for but it might help.

Apart from that, you could run the query in a client, such as in go or python, and do what you want with the timestamps.

If you are using Grafana, there is an option to dislay the time between the timestamp and now. You need to choose a unit called ‘from now’.

https://docs.influxdata.com/influxdb/v1.7/query_language/functions#elapsed

Thank you for the answer! I will look into that.

So, if i want to do something with the timestamps, i really need to use Python or something similar?

What i want to do is like you wrote and it is interesting!

I want to retrieve the time (from now) and show the time in a table (Add another column) and if i can, do some arithmetic on those value. Like comparing 2 times or adding 2 times and etc.

But so far, i have seen nothing that can do that. Do you think it is possible to do that with what you suggested?

  • Dave