Clean up type casts

This commit is contained in:
Michael Vines
2019-03-01 13:10:17 -08:00
parent a72325dbc2
commit fdc31e99df
7 changed files with 12 additions and 15 deletions

View File

@ -2,7 +2,7 @@
use std::time::Duration;
use std::time::{SystemTime, UNIX_EPOCH};
pub const NUM_TICKS_PER_SECOND: usize = 10;
pub const NUM_TICKS_PER_SECOND: u64 = 10;
// At 10 ticks/s, 8 ticks per slot implies that leader rotation and voting will happen
// every 800 ms. A fast voting cadence ensures faster finality and convergence
@ -17,7 +17,7 @@ pub const DEFAULT_SLOTS_PER_EPOCH: u64 = 64;
/// not be processed by the network.
pub const MAX_HASH_AGE_IN_SECONDS: usize = 120;
pub const MAX_RECENT_TICK_HASHES: usize = NUM_TICKS_PER_SECOND * MAX_HASH_AGE_IN_SECONDS;
pub const MAX_RECENT_TICK_HASHES: usize = NUM_TICKS_PER_SECOND as usize * MAX_HASH_AGE_IN_SECONDS;
pub fn duration_as_us(d: &Duration) -> u64 {
(d.as_secs() * 1000 * 1000) + (u64::from(d.subsec_nanos()) / 1_000)