From 578a2af303dfadf7dcfb1d756327db41b60fb596 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 28 Sep 2018 18:43:55 +0900 Subject: [PATCH] ing --- src/app/pages/home/home-page.component.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/pages/home/home-page.component.ts b/src/app/pages/home/home-page.component.ts index f15cc44..9e49d1c 100644 --- a/src/app/pages/home/home-page.component.ts +++ b/src/app/pages/home/home-page.component.ts @@ -48,13 +48,17 @@ export class DiscoveryResult { const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((distance % (1000 * 60)) / 1000); - __this.elapsedTime = hours + ':' + minutes + ':' + seconds; + __this.setElapsedTime(hours, minutes, seconds); }, 1000); } - stop(elapsedTime: string) { + setElapsedTime(hour: number, minute: number, second: number) { + this.elapsedTime = String(hour).padStart(2, '0') + ':' + String(minute).padStart(2, '0') + ':' + String(second).padStart(2, '0'); + } + + stop(hours: number, minutes: number, seconds: number) { clearInterval(this.hTimer); - this.elapsedTime = elapsedTime; + this.setElapsedTime(hours, minutes, seconds); } increaseHost() { @@ -726,7 +730,7 @@ export class HomePageComponent implements OnInit, OnDestroy { this.simulationRestart(true); this.zoomToFit(0.95, 500); - this.discoveryResult.stop(hours + ':' + minutes + ':' + seconds); + this.discoveryResult.stop(hours, minutes, seconds); // this.resultMsg = []; // this.resultMsg.push(hostCount + ''); // this.resultMsg.push(serviceCount + '');