diff --git a/src/core/pdu/mod.rs b/src/core/pdu/mod.rs index 0c54812e..a4254b08 100644 --- a/src/core/pdu/mod.rs +++ b/src/core/pdu/mod.rs @@ -116,7 +116,11 @@ impl PduEvent { .map_or_else(|| Ok(BTreeMap::new()), |u| serde_json::from_str(u.get())) .map_err(|_| Error::bad_database("Invalid unsigned in pdu event"))?; - unsigned.insert("age".to_owned(), to_raw_value(&1).unwrap()); + let now: u64 = MilliSecondsSinceUnixEpoch::now().get().into(); + let then: u64 = self.origin_server_ts.into(); + let this_age: u64 = now - then; + + unsigned.insert("age".to_owned(), to_raw_value(&this_age).unwrap()); self.unsigned = Some(to_raw_value(&unsigned).expect("unsigned is valid")); Ok(())