You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to this, one can expect that maximum possible duration value is at least i64::MAX seconds. But in fact, the full range that i64 seconds gives us is restricted to i64::MAX milliseconds (see #16626 for more details).
I offer to change the internal representation of Duration to
pub struct Duraion {
ticks: i64, // A single tick represents 100 nanoseconds
nanos: i8 // to hold values from -99 to 99
}
Some pros:
Internals of struct Duraion are not exposed. So, we are free to change them.
At the moment the
Durationtype looks likeAccording to this, one can expect that maximum possible duration value is at least
i64::MAXseconds. But in fact, the full range that i64 seconds gives us is restricted toi64::MAXmilliseconds (see #16626 for more details).I offer to change the internal representation of
DurationtoSome pros:
struct Duraionare not exposed. So, we are free to change them.num_millisecondsetc will return correct i64 values (see libstd: Refactor Duration. #16626).TimeSpanin .NET andDurationin Joda-Time types do the same.Some cons:
Durationwill be shorter:i64::MAXseconds gives us 106751991167300 days. We don't useneedit.i64::MAXmilliseconds gives us 106751991167 days. This is our current choice.i64::MAXticks gives us 10675199 days. The range is still long enough, who cares?