Skip to content

Commit ddf4dc6

Browse files
da2ce7josecelano
authored andcommitted
fix: fix doc for DateTime overflow panic
1 parent b7e78ab commit ddf4dc6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/shared/clock/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ pub trait TimeNow: Time {
9090
///
9191
/// # Panics
9292
///
93-
/// Will panic if the input time cannot be converted to `DateTime::<Utc>`.
94-
/// <https://en.wikipedia.org/wiki/Year_2038_problem>
93+
/// Will panic if the input time cannot be converted to `DateTime::<Utc>`, internally using the `i64` type.
94+
/// (this will naturally happen in 292.5 billion years)
9595
#[must_use]
9696
pub fn convert_from_iso_8601_to_timestamp(iso_8601: &str) -> DurationSinceUnixEpoch {
9797
convert_from_datetime_utc_to_timestamp(&DateTime::<Utc>::from_str(iso_8601).unwrap())
@@ -103,8 +103,8 @@ pub fn convert_from_iso_8601_to_timestamp(iso_8601: &str) -> DurationSinceUnixEp
103103
///
104104
/// # Panics
105105
///
106-
/// Will panic if the input time overflows the u64 type.
107-
/// <https://en.wikipedia.org/wiki/Year_2038_problem>
106+
/// Will panic if the input time overflows the `u64` type.
107+
/// (this will naturally happen in 584.9 billion years)
108108
#[must_use]
109109
pub fn convert_from_datetime_utc_to_timestamp(datetime_utc: &DateTime<Utc>) -> DurationSinceUnixEpoch {
110110
DurationSinceUnixEpoch::from_secs(u64::try_from(datetime_utc.timestamp()).expect("Overflow of u64 seconds, very future!"))
@@ -116,8 +116,8 @@ pub fn convert_from_datetime_utc_to_timestamp(datetime_utc: &DateTime<Utc>) -> D
116116
///
117117
/// # Panics
118118
///
119-
/// Will panic if the input time overflows the i64 type.
120-
/// <https://en.wikipedia.org/wiki/Year_2038_problem>
119+
/// Will panic if the input time overflows the `u64` seconds overflows the `i64` type.
120+
/// (this will naturally happen in 292.5 billion years)
121121
#[must_use]
122122
pub fn convert_from_timestamp_to_datetime_utc(duration: DurationSinceUnixEpoch) -> DateTime<Utc> {
123123
DateTime::<Utc>::from_utc(

src/tracker/auth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ impl ExpiringKey {
120120
///
121121
/// # Panics
122122
///
123-
/// Will panic when the key timestamp overflows the ui64 type.
124-
/// <https://en.wikipedia.org/wiki/Year_2038_problem>
123+
/// Will panic when the key timestamp overflows the internal i64 type.
124+
/// (this will naturally happen in 292.5 billion years)
125125
#[must_use]
126126
pub fn expiry_time(&self) -> chrono::DateTime<chrono::Utc> {
127127
convert_from_timestamp_to_datetime_utc(self.valid_until)

0 commit comments

Comments
 (0)