Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nimarion committed Nov 9, 2024
2 parents 88c3c63 + 31bd328 commit fc4143e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/performance-conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ export function performanceToFloat({
const parts = performance.split(':');

if (parts.length === 1) {
return parseFloat(parts[0]) * 1000;
return parseFloat(parts[0]) * 1000 | 0;
}

if (parts.length === 2) {
const [minutes, rest] = parts;
const seconds = parseFloat(rest);
return (parseInt(minutes) * 60 + seconds) * 1000;
return (parseInt(minutes) * 60 + seconds) * 1000 | 0;
}

if (parts.length === 3) {
const [hours, minutes, seconds] = parts.map((part) => parseInt(part));
return (hours * 3600 + minutes * 60 + seconds) * 1000;
return (hours * 3600 + minutes * 60 + seconds) * 1000 | 0;
}

throw new Error(`Invalid performance: ${performance}`);
Expand Down

0 comments on commit fc4143e

Please sign in to comment.