From c4d289956275677b24459237d13ed8c23a606079 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 23 Mar 2020 17:47:35 +0530 Subject: implement time travelling --- src/util/time.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/util') diff --git a/src/util/time.ts b/src/util/time.ts index 88297f9a9..2740c361f 100644 --- a/src/util/time.ts +++ b/src/util/time.ts @@ -34,9 +34,15 @@ export interface Duration { readonly d_ms: number | "forever"; } +let timeshift: number = 0; + +export function setDangerousTimetravel(dt: number) { + timeshift = dt; +} + export function getTimestampNow(): Timestamp { return { - t_ms: new Date().getTime(), + t_ms: new Date().getTime() + timeshift, }; } -- cgit v1.2.3