-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
Allow getting the PrimitiveDateTime of a OffsetDateTime #458
Conversation
Codecov Report
@@ Coverage Diff @@
## main #458 +/- ##
==========================================
- Coverage 99.74% 99.69% -0.05%
==========================================
Files 62 62
Lines 6265 6268 +3
==========================================
Hits 6249 6249
- Misses 16 19 +3
Continue to review full report at Codecov.
|
Why would this not be allowed? Obviously many people would like to do this. It is only logical as for many instances you do not want to have any Offset at all. Just the pure UTC and this will enforce only UTC by type. The usage of time in programming does not necessarily require an offset handling. In many calculations just the actual time passed is needed. If it is in Offset UTC or Offset +5 does not matter. Besides that there is also no way that new() is as fast as copying the underlying data structure directly. |
Please read the linked issues. I have repeatedly articulated my reasons for declining this request and will not do so again here. |
I have read those comments. Fine that you wish that people be safe with Time and 'most' people need the offset. The argument of internal representation changing is flawed due to the fact that PrimitiveDateTime is also a public struct and thus using date and time to create it will then likely also be broken due to this internal restructuring. |
People want the You want to discard information that is absolutely necessary. I have yet to see a use case where this API is actually needed. To give you an idea of how easy it is to get wrong, your comment is wrong.
This is not what you're doing in the PR. Time is complicated, and you should never discard information you have about the offset. Doing so is extremely error prone. Unless you truly have something new to add, I'm not going to keep responding. I've been over this before. |
Are you saying that creating an OffsetDateTime using Please enlighten me on why it is not the same, cause i would love to know...
Yeah only when you actually need the offset. If you actually do not need the offset it is not. If you read my comment above time passing is not different in UTC or +5 offsets. Anyways, you can do what you want but it is apparent that people would like this in the API and you are unwilling to provide such access based on flawed arguments. |
If you need the time passed, you should use If you call Stop calling my arguments "flawed". I have clearly articulated my reasons. I have far more experience with time handling and my goal is to reduce the amount of things you do wrong. Not implementing this request is part of doing that. |
I am well aware. Thank you! I only want to do time arithmetic in the UTC timezone so keeping a timezone is useless.
Well, sadly they just are partially flawed. You can not use Duration if the Duration is yet unknown. I can not use Instant as it does not provide the full functionality required to do complex calculations and your offset eats into my limited embedded memory. If i had plenty to spare I would really be fine with your view and technically I truly understand it. But this just wastes compute cycles and memory. Anyways, I do not think we will figure this out. Which tbh, is kinda sad as your crate is all around the best related to time. |
It's semantic information that is certainly not useless.
I mentioned You mention "complex calculations" but do not elaborate. Without an actual use case, which I've already indicated I do not have, I have no reason to add an API like this. You need to explain why |
I can't it has to do with signal processing. I recognize working with time is hard that is the sole reason I want to use your crate. But the inability to go from Offset to Primitive just makes it all the more awkward. If instants had a more elaborate API (similar to Primitive), I would use it. Is this something that you do feel ok with (allowing) extending? |
Within one minute of posting because I got the method name wrong. I never suggested using the entirety of
What's that?
Then I'm afraid I can't help you in any way. The lack of a defined use case does not lead to things getting added. Declining to elaborate just means I still don't have a use case.
|
lets just agree that this wont work out. I don't see the point in arguing with you. You and I are both set in our ways and it seems that there is little room for an agreement.
I never implied such a thing. I have accepted that it won't be added. If I was allowed to share more information I would.
Replacing of seconds, nanoseconds, etc. I would like to add that there is something to say for providing access to the primitive. Anyways, Jacob, if you are still not inclined to add the functionality I would like to thank you for your time and work on this crate. Best wishes :) |
I'm not set in my ways, I just haven't seen a use case.
This is the fundamental point. Primitive means there is no offset or an unknown offset, not that the offset is UTC. |
This is already possible through getting the date and time and making a primitive but would just be nicer to have easy API.