summaryrefslogtreecommitdiff
path: root/src/scripts/util.ts
diff options
context:
space:
mode:
authorGeorgios Andreadis <G.Andreadis@student.tudelft.nl>2017-02-26 18:34:13 +0100
committerGitHub <noreply@github.com>2017-02-26 18:34:13 +0100
commitdf65449694e17a367e59b112c0cc12d66c387ca9 (patch)
tree6a2589cb5cdc86bdcfe47f4b399f385c6a5ecbc7 /src/scripts/util.ts
parent30fb1767715f347246368b7f2462ccfae9413330 (diff)
parent495deb1815b465230d0831d0132e85ba207ac528 (diff)
Merge pull request #6 from tudelft-atlarge/bugfixes
Fixes for bugs in experiment simulation
Diffstat (limited to 'src/scripts/util.ts')
-rw-r--r--src/scripts/util.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/scripts/util.ts b/src/scripts/util.ts
index 7aa615ec..d3a2ea58 100644
--- a/src/scripts/util.ts
+++ b/src/scripts/util.ts
@@ -599,4 +599,15 @@ export class Util {
return i.toString();
})
}
+
+ /**
+ * Returns an array containing all numbers of a range from 0 to x (including x).
+ */
+ public static timeRange(x: number): Date[] {
+ return Util.range(x).map((tick: number) => {
+ const t = new Date(1970, 0, 1); // Epoch
+ t.setSeconds(tick);
+ return t;
+ });
+ }
}