diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-03-23 17:47:35 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-03-23 17:47:35 +0530 |
commit | c4d289956275677b24459237d13ed8c23a606079 (patch) | |
tree | 53f340c001c36fbb15dbd0f7ace2606371c52c30 /src/util | |
parent | 1b0b3f146c829caf04a42984d1a09a7c80b867c4 (diff) |
implement time travelling
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/time.ts | 8 |
1 files changed, 7 insertions, 1 deletions
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, }; } |