influxdb-python
influxdb-python copied to clipboard
Is it possible to directly use timestamps in epoch format?
-
InfluxDB version: 1.8.4 (output of the
influx -version
command) - InfluxDB-python version: 5.3.1 (output of pip3 list|grep influx)"` command)
- Python version: 3.7.3
- Operating system version: Armbian 20.02.1 aarch64
My sensor uses UTC epoch timestamps as a floating point number in seconds including nanoseconds, would it be possible to use them directly with influxdb-python without first converting them to string format? I understand that influx itself uses the EPOCH format as 64bits nanoseconds, so I could just multiply my timestamp by 10^9.
I currently convert timestamps via strftime which is not so efficient since the library will convert it back.
timestamp="%s.%09dZ"%(time.strftime('%Y-%m-%dT%H:%M:%S',time.gmtime(my_ts)),(my_ts%1)*1000000000)
Kind regards, Dennis