mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-08 06:30:01 +02:00
ues saturating_sub to avoid panics
This commit is contained in:
parent
f0ddd8e52c
commit
934650ce9a
1 changed files with 1 additions and 1 deletions
|
@ -119,7 +119,7 @@ impl PduEvent {
|
||||||
// deliberately allowing for the possibility of negative age
|
// deliberately allowing for the possibility of negative age
|
||||||
let now: i128 = MilliSecondsSinceUnixEpoch::now().get().into();
|
let now: i128 = MilliSecondsSinceUnixEpoch::now().get().into();
|
||||||
let then: i128 = self.origin_server_ts.into();
|
let then: i128 = self.origin_server_ts.into();
|
||||||
let this_age: i128 = now - then;
|
let this_age: i128 = now.saturating_sub(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