More fixes for bigint duration (#3557)

This commit is contained in:
JT
2021-06-05 04:54:18 +12:00
committed by GitHub
parent 51890baace
commit 1d0d0425d4
4 changed files with 36 additions and 24 deletions

View File

@ -587,21 +587,21 @@ impl Unit {
Unit::Tebibyte => filesize(size * 1024 * 1024 * 1024 * 1024),
Unit::Pebibyte => filesize(size * 1024 * 1024 * 1024 * 1024 * 1024),
Unit::Nanosecond => duration(size.to_i64().expect("Conversion should never fail.")),
Unit::Nanosecond => duration(size.to_bigint().expect("Conversion should never fail.")),
Unit::Microsecond => {
duration(size.to_i64().expect("Conversion should never fail.") * 1000)
duration(size.to_bigint().expect("Conversion should never fail.") * 1000)
}
Unit::Millisecond => {
duration(size.to_i64().expect("Conversion should never fail.") * 1000 * 1000)
}
Unit::Second => {
duration(size.to_i64().expect("Conversion should never fail.") * 1000 * 1000 * 1000)
duration(size.to_bigint().expect("Conversion should never fail.") * 1000 * 1000)
}
Unit::Second => duration(
size.to_bigint().expect("Conversion should never fail.") * 1000 * 1000 * 1000,
),
Unit::Minute => duration(
size.to_i64().expect("Conversion should never fail.") * 60 * 1000 * 1000 * 1000,
size.to_bigint().expect("Conversion should never fail.") * 60 * 1000 * 1000 * 1000,
),
Unit::Hour => duration(
size.to_i64().expect("Conversion should never fail.")
size.to_bigint().expect("Conversion should never fail.")
* 60
* 60
* 1000
@ -609,7 +609,7 @@ impl Unit {
* 1000,
),
Unit::Day => duration(
size.to_i64().expect("Conversion should never fail.")
size.to_bigint().expect("Conversion should never fail.")
* 24
* 60
* 60
@ -618,7 +618,7 @@ impl Unit {
* 1000,
),
Unit::Week => duration(
size.to_i64().expect("Conversion should never fail.")
size.to_bigint().expect("Conversion should never fail.")
* 7
* 24
* 60