Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Is it possible to directly use timestamps in epoch format? #880

Open
@bijwaard

Description

@bijwaard
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions