Change time to use i64 instead of u64
This commit is contained in:
12
src/batch.rs
12
src/batch.rs
@@ -9,7 +9,7 @@ pub(crate) struct Skill {
|
||||
pub(crate) forward: Gaussian,
|
||||
backward: Gaussian,
|
||||
likelihood: Gaussian,
|
||||
pub(crate) elapsed: u64,
|
||||
pub(crate) elapsed: i64,
|
||||
pub(crate) online: Gaussian,
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ impl Event {
|
||||
pub struct Batch {
|
||||
pub(crate) events: Vec<Event>,
|
||||
pub(crate) skills: HashMap<Index, Skill>,
|
||||
pub(crate) time: u64,
|
||||
pub(crate) time: i64,
|
||||
p_draw: f64,
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ impl Batch {
|
||||
composition: Vec<Vec<Vec<Index>>>,
|
||||
results: Vec<Vec<f64>>,
|
||||
weights: Vec<Vec<Vec<f64>>>,
|
||||
time: u64,
|
||||
time: i64,
|
||||
p_draw: f64,
|
||||
agents: &mut HashMap<Index, Agent>,
|
||||
) -> Self {
|
||||
@@ -444,10 +444,10 @@ impl Batch {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_elapsed(last_time: u64, actual_time: u64) -> u64 {
|
||||
if last_time == u64::MIN {
|
||||
pub(crate) fn compute_elapsed(last_time: i64, actual_time: i64) -> i64 {
|
||||
if last_time == i64::MIN {
|
||||
0
|
||||
} else if last_time == u64::MAX {
|
||||
} else if last_time == i64::MAX {
|
||||
1
|
||||
} else {
|
||||
actual_time - last_time
|
||||
|
||||
Reference in New Issue
Block a user