Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cubic-bezier/view/cubic-bezier-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class CubicBezierPreviewView implements View {
this.updateMarker_(0);
this.markerElem_.classList.add(className('m', 'a'));

this.startTime_ = new Date().getTime() + PREVIEW_DELAY;
this.startTime_ = Date.now() + PREVIEW_DELAY;
this.stopped_ = false;
requestAnimationFrame(this.onTimer_);
}
Expand Down Expand Up @@ -105,7 +105,7 @@ export class CubicBezierPreviewView implements View {
return;
}

const dt = new Date().getTime() - this.startTime_;
const dt = Date.now() - this.startTime_;
const p = dt / PREVIEW_DURATION;
this.updateMarker_(p);

Expand Down
4 changes: 2 additions & 2 deletions src/fps-graph/controller/fps-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ export class FpsGraphController implements Controller<FpsView> {
}

public begin(): void {
this.stopwatch_.begin(new Date());
this.stopwatch_.begin(Date.now());
}

public end(): void {
this.stopwatch_.end(new Date());
this.stopwatch_.end(Date.now());
}

private onTick_(): void {
Expand Down
8 changes: 4 additions & 4 deletions src/fps-graph/model/stopwatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export class Fpswatch {
return this.fps_;
}

public begin(now: Date): void {
this.start_ = now.getTime();
public begin(now: number): void {
this.start_ = now;
}

private calculateFps_(nowTime: number): number | null {
Expand All @@ -48,12 +48,12 @@ export class Fpswatch {
this.frameCount_ -= df;
}

public end(now: Date): void {
public end(now: number): void {
if (this.start_ === null) {
return;
}

const t = now.getTime();
const t = now;
this.duration_ = t - this.start_;
this.start_ = null;

Expand Down