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

[BUG]: DateTimeOffsetConverter uses 32-bit integer instead of 64-bit #590

Closed
1 task done
martincostello opened this issue Oct 9, 2024 · 1 comment · Fixed by #591
Closed
1 task done

[BUG]: DateTimeOffsetConverter uses 32-bit integer instead of 64-bit #590

martincostello opened this issue Oct 9, 2024 · 1 comment · Fixed by #591
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@martincostello
Copy link
Contributor

martincostello commented Oct 9, 2024

What happened?

When converting numbers to DateTimeOffset instances, a 32-bit integer (int) is used:

private static DateTimeOffset HandleNumber(Utf8JsonReader reader) => DateTimeOffset.FromUnixTimeSeconds(reader.GetInt32());

The DateTimeOffset.FromUnixTimeSeconds() method accepts a long rather than an int, which means two things:

  1. There's a hidden implicit conversion paid to convert the value anyway.
  2. The code will stop working for timestamps representing times greater than 19/01/2038 03:14:07 +00:00.

I just happened to notice this while reviewing something in the code.

Versions

All

Relevant log output

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct
@martincostello martincostello added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Oct 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant