Skip to content
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

From<Timestamp> for time::Duration faulty #27

Closed
EtomicBomb opened this issue Jan 12, 2021 · 1 comment
Closed

From<Timestamp> for time::Duration faulty #27

EtomicBomb opened this issue Jan 12, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@EtomicBomb
Copy link

I know this should be a pull request but in

impl From<Timestamp> for time::Duration {
    fn from(ts: Timestamp) -> Self {
        time::Duration::new(ts.sec as u64, (ts.usec / 1000) as u32)
    }
}

ts.usec should be multiplied by 1000 and not divided

@EtomicBomb
Copy link
Author

And now that I'm looking at that part of the code, From<time::Duration> for Timestamp looks incorrect too - I think in the line

Timestamp::new(duration.as_secs() as time_t, duration.as_micros() as time_t)

duration.as_micros() should be duration.subsec_micros()

@raymanfx raymanfx self-assigned this Apr 18, 2021
@raymanfx raymanfx added the bug Something isn't working label Apr 18, 2021
raymanfx added a commit that referenced this issue Apr 18, 2021
Fixes #27.

Signed-off-by: Christopher N. Hesse <raymanfx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants