Skip to content

Commit

Permalink
feat: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed Jun 10, 2024
1 parent 0af94f8 commit 8083189
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/js/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@ const LineChart = memo(({ theme }: LineChartProps) => {
);
});

function formatTime(time: number): string {
const mins = Math.floor(time / 600);
const secs = Math.floor(time / 10) % 60;
const ms = Math.floor(time % 10);
function pad(value: number): string {
return value.toString().padStart(2, '0');
}

if (secs < 10) return `${mins}:0${secs}.${ms}`;
function formatTime(time: number): string {
const secs = time % 60;
const mins = Math.floor(time / 60) % 60;
const hours = Math.floor(time / 3600);

return `${mins}:${secs}.${ms}`;
return `${pad(hours)}:${pad(mins)}:${pad(secs)}`;
}

function requestInterval(callback: (...args: any[]) => void, interval: number): () => void {
Expand Down

0 comments on commit 8083189

Please sign in to comment.