georust / gpx

Rust read/write support for GPS Exchange Format (GPX)
https://crates.io/crates/gpx
MIT License
102 stars 46 forks source link

How to access the time of a waypoint? #79

Closed gerritsangel closed 1 year ago

gerritsangel commented 2 years ago

Hello,

Thanks a lot for the crate! This makes handling of gpx files really easy.

I have one question though: How can I, as a consumer, properly work with the time of a waypoint? Maybe I'm missing it, but although with the newest commit, the Time struct is exported, I can only format it directly to a string. I would like to have it as a chrono DateTime to further do some calculations on it.

Currently it seems that I have to format it as a String (involving an allocation), just to have it again parsed again by chrono.

What about a chrono feature of the crate, which could transform the Time as a chrono DateTime?

major-seven commented 2 years ago

I just wanted to come here and ask exactly the same thing. :) I think a quick workaround would be to just use OffsetDateTime::parse(time_string.as_str(), &Rfc3339) since it seems to be only possible to extract the time as a string. However it would be more efficient to directly use the already existing OffsetDateTime and omit the second string parsing. Is there a reason that the OffsetDateTime field in the gpx Time struct is private and not public?

lnicola commented 2 years ago

See #76.

michaelkirk commented 2 years ago

So it looks like the feature has been added and at this point we're just waiting on a release, is that right?

@lnicola - would you be interested in becoming a publisher for this crate?

lnicola commented 2 years ago

So it looks like the feature has been added and at this point we're just waiting on a release, is that right?

I'm not sure that's the greatest API, but we're only on 0.8, so sure.

would you be interested in becoming a publisher for this crate?

Sure, I can do this if needed, but it's a bit weird to cut out new releases for a crate I've never used :sweat_smile:.

michaelkirk commented 2 years ago

would you be interested in becoming a publisher for this crate?

Added - publish at will!

lnicola commented 2 years ago

I'll try to do this tomorrow.. where did the last 10 days go? :cry:

jscatena88 commented 1 year ago

Looks like this still hasn't been published. Any chance to make it happen?

lnicola commented 1 year ago

Looking into it now, sorry. First part is https://github.com/georust/gpx/pull/86.

lnicola commented 1 year ago

gpx 0.9.0 is up on crates.io, I hope I didn't mess something up.

jscatena88 commented 1 year ago

@lnicola It worked perfect for my use case! Thanks a bunch