diff --git a/ch9/ch9-clock3/src/main.rs b/ch9/ch9-clock3/src/main.rs index a5c49632..b3c644c9 100644 --- a/ch9/ch9-clock3/src/main.rs +++ b/ch9/ch9-clock3/src/main.rs @@ -39,8 +39,8 @@ struct NTPResult { impl NTPResult { fn offset(&self) -> i64 { - let duration = (self.t2 - self.t1) + (self.t4 - self.t3); - duration.num_milliseconds() / 2 + let delta = self.delay(); + delta.abs() / 2 } fn delay(&self) -> i64 {