Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Signed-off-by: Timo K <[email protected]>
  • Loading branch information
toger5 committed Nov 2, 2023
1 parent 55a621b commit 40bd188
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/models/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,14 +664,16 @@ export class MatrixEvent extends TypedEventEmitter<MatrixEventEmittedEvents, Mat
}

/**
* The fallbackAge is computed by using the origin_server_ts. So it is not adjusted
* The fallbackAge is computed by using the origin_server_ts. So it is not adjusted
* to the local device clock. It should never be used.
* If there is no unsigned field in the event this is a better fallback then 0.
* It is supposed to only be used like this: `ev.getAge() ?? ev.fallbackAge()`
*/
private fallbackAge(): number{
if(!this.getAge()) {
logger.warn("Age for event was not available, using `now - origin_server_ts` as a fallback. If the device clock is not correct issues might occur.");
private fallbackAge(): number {
if (!this.getAge()) {
logger.warn(
"Age for event was not available, using `now - origin_server_ts` as a fallback. If the device clock is not correct issues might occur.",
);
}
return Math.max(Date.now() - this.getTs(), 0);
}
Expand Down

0 comments on commit 40bd188

Please sign in to comment.