mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-08 04:30:02 +02:00
allow negative age
This commit is contained in:
parent
f8d341002e
commit
f0ddd8e52c
1 changed files with 4 additions and 3 deletions
|
@ -116,9 +116,10 @@ impl PduEvent {
|
||||||
.map_or_else(|| Ok(BTreeMap::new()), |u| serde_json::from_str(u.get()))
|
.map_or_else(|| Ok(BTreeMap::new()), |u| serde_json::from_str(u.get()))
|
||||||
.map_err(|_| Error::bad_database("Invalid unsigned in pdu event"))?;
|
.map_err(|_| Error::bad_database("Invalid unsigned in pdu event"))?;
|
||||||
|
|
||||||
let now: u64 = MilliSecondsSinceUnixEpoch::now().get().into();
|
// deliberately allowing for the possibility of negative age
|
||||||
let then: u64 = self.origin_server_ts.into();
|
let now: i128 = MilliSecondsSinceUnixEpoch::now().get().into();
|
||||||
let this_age: u64 = now - then;
|
let then: i128 = self.origin_server_ts.into();
|
||||||
|
let this_age: i128 = now - then;
|
||||||
|
|
||||||
unsigned.insert("age".to_owned(), to_raw_value(&this_age).unwrap());
|
unsigned.insert("age".to_owned(), to_raw_value(&this_age).unwrap());
|
||||||
self.unsigned = Some(to_raw_value(&unsigned).expect("unsigned is valid"));
|
self.unsigned = Some(to_raw_value(&unsigned).expect("unsigned is valid"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue