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 + '');