Skip to content
New issue

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

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

Already on GitHub? # to your account

Document DateTime format #80

Open
arg0d opened this issue Jun 19, 2024 · 3 comments
Open

Document DateTime format #80

arg0d opened this issue Jun 19, 2024 · 3 comments

Comments

@arg0d
Copy link
Contributor

arg0d commented Jun 19, 2024

C# bindings expect and produce DateTime objects in UTC format. This needs to be documented in some form. #66

@meenzen
Copy link
Contributor

meenzen commented Jan 16, 2025

IMHO the generated bindings should be using DateTimeOffset with forced conversion to UTC, like I previously suggested. It is way too easy to make mistakes when using DateTime.

@arg0d
Copy link
Contributor Author

arg0d commented Jan 16, 2025

At this point I don't really remember/understand what's the issue. I'm looking at the chronological test file, and it kinda makes sense. Rust's SystemTime::Now() and DateTime.UtcNow return the same date string. So where is the problem?

@meenzen
Copy link
Contributor

meenzen commented Jan 16, 2025

The problem is that it's extremely easy to pass a non-utc DateTime from C#. If the bindings would instead expose DateTimeOffset then this would be impossible. DateTimeOffset is the default for all new APIs. The new TimeProvider class for example only exposes DateTimeOffset.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants