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

fix timestamp warnings #791

Merged
merged 2 commits into from
Sep 18, 2023
Merged

fix timestamp warnings #791

merged 2 commits into from
Sep 18, 2023

Conversation

XAMPPRocky
Copy link
Collaborator

This is preventing all other PRs from succeeding.

@@ -70,7 +70,7 @@ impl Ping {
}
};

let recv_time = chrono::Utc::now().timestamp_nanos();
let recv_time = chrono::Utc::now().timestamp_nanos_opt().unwrap();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any risk of timestamp_nanos_opt() returning None ?

Copy link
Collaborator Author

@XAMPPRocky XAMPPRocky Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if people are still running Quilkin in a couple hundred years. https://docs.rs/chrono/latest/chrono/struct.DateTime.html#method.timestamp_nanos_opt

An i64 with nanosecond precision can span a range of ~584 years. This function panics on an out of range DateTime.
The dates that can be represented as nanoseconds are between 1677-09-21T00:12:44.0 and 2262-04-11T23:47:16.854775804.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can only hope 😃

@XAMPPRocky XAMPPRocky enabled auto-merge (squash) September 18, 2023 19:37
@XAMPPRocky XAMPPRocky merged commit 36d14d4 into main Sep 18, 2023
5 checks passed
@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: 290c3a92-4c46-47ac-8e44-5d63389b9957

The following development images have been built, and will exist for the next 30 days:

To build this version:

git fetch git@github.com:googleforgames/quilkin.git pull/791/head:pr_791 && git checkout pr_791
cargo build

@markmandel markmandel deleted the ep/fix-chrono-warnings branch September 20, 2023 15:53
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Refactoring code, fixing up documentation, etc size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants