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

request to simplify parsing unix millis #862

Closed
wcarmon opened this issue Nov 2, 2022 · 4 comments
Closed

request to simplify parsing unix millis #862

wcarmon opened this issue Nov 2, 2022 · 4 comments

Comments

@wcarmon
Copy link

wcarmon commented Nov 2, 2022

I believe the code to parse unix millis looks something like this

let nanos = ((ux_millis % 1000) * 1_000_000) as u32;
let ndt = NaiveDateTime::from_timestamp(ux_millis / 1000, nanos);
let ts = DateTime::<Utc>::from_utc(ndt, Utc);

can we have something like this instead?

let ndt = NaiveDateTime::from_timestamp_millis(ux_millis);
let ts = DateTime::<Utc>::from_utc(ndt, Utc);
@djc
Copy link
Member

djc commented Nov 3, 2022

Yes, would you like to submit a PR?

@esheppa
Copy link
Collaborator

esheppa commented Nov 3, 2022

We already have this via #818 and #823. @wcarmon you can depend on main or 0.4.x to get this now, otherwise you'll have to wait for 0.4.23 release

@djc
Copy link
Member

djc commented Nov 3, 2022

For 0.4.23 release planning, see #850.

@djc djc closed this as completed Nov 3, 2022
@djc djc closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2022
@wcarmon
Copy link
Author

wcarmon commented Nov 3, 2022

Thanks! I appreciate you both @esheppa & @djc

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

3 participants