Skip to content

Incorrect calculation of Microseconds timestamp #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
amonin7 opened this issue Feb 13, 2024 · 1 comment
Closed

Incorrect calculation of Microseconds timestamp #133

amonin7 opened this issue Feb 13, 2024 · 1 comment

Comments

@amonin7
Copy link
Contributor

amonin7 commented Feb 13, 2024

Right now, the conversion from influxdb::query::Timestamp::Microseconds to chrono::Datetime is incorrect:

            Timestamp::Microseconds(mis) => {
                let nanos = mis / 10000;
                Utc.timestamp_nanos(nanos.try_into().unwrap())
            }

In this case, nanos should be calculated by multiplying mis by MICROS_PER_NANO, which equals 1000.

p.s. If I understand correctly, this bug affects the correctness of timestamps stored in the influxdb and, therefore, if one uses microseconds precision to store the data - the time of the data in the database would be incorrect.

@msrd0
Copy link
Collaborator

msrd0 commented Feb 14, 2024

Interesting. Looks like this has been wrong since version 0.0.6, introduced in #41

@msrd0 msrd0 closed this as completed Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants