aboutsummaryrefslogtreecommitdiff
path: root/ui/src/common/time.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/common/time.ts')
-rw-r--r--ui/src/common/time.ts22
1 files changed, 2 insertions, 20 deletions
diff --git a/ui/src/common/time.ts b/ui/src/common/time.ts
index fce992dab..33e13b899 100644
--- a/ui/src/common/time.ts
+++ b/ui/src/common/time.ts
@@ -14,8 +14,6 @@
import {assertTrue} from '../base/logging';
-const EPSILON = 0.0000000001;
-
// TODO(hjd): Combine with timeToCode.
export function timeToString(sec: number) {
const units = ['s', 'ms', 'us', 'ns'];
@@ -33,17 +31,6 @@ export function fromNs(ns: number) {
return ns / 1e9;
}
-export function toNsFloor(seconds: number) {
- return Math.floor(seconds * 1e9);
-}
-
-export function toNsCeil(seconds: number) {
- return Math.ceil(seconds * 1e9);
-}
-
-export function toNs(seconds: number) {
- return Math.round(seconds * 1e9);
-}
// 1000000023ns -> "1.000 000 023"
export function formatTimestamp(sec: number) {
@@ -91,9 +78,8 @@ export class TimeSpan {
return new TimeSpan(this.start, this.end);
}
- equals(other: TimeSpan): boolean {
- return Math.abs(this.start - other.start) < EPSILON &&
- Math.abs(this.end - other.end) < EPSILON;
+ equals(other: TimeSpan) {
+ return this.start === other.start && this.end === other.end;
}
get duration() {
@@ -107,8 +93,4 @@ export class TimeSpan {
add(sec: number): TimeSpan {
return new TimeSpan(this.start + sec, this.end + sec);
}
-
- contains(other: TimeSpan) {
- return this.start <= other.start && other.end <= this.end;
- }
}