Skip to content

Commit

Permalink
Fix offset calculation (fixes #51)
Browse files Browse the repository at this point in the history
  • Loading branch information
timClicks committed Nov 4, 2021
1 parent cff02d5 commit 39e24d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ch9/ch9-clock3/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 39e24d7

Please sign in to comment.