diff options
author | bobzel <zzzman@gmail.com> | 2020-08-06 23:15:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 23:15:47 -0400 |
commit | 20149e4849b8c24ba98ea1372f6ab3def6585265 (patch) | |
tree | eb507b7b163549304c46cdd1cf6b3690ff1defc7 /src/Utils.ts | |
parent | 0910e7387fae485d7c11eb71b6abcce865403b13 (diff) | |
parent | 301b10ba693dc76ebcd42d3fa4020410f2092bee (diff) |
Merge pull request #506 from browngraphicslab/new_audio
New audio
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 0b057dc23..6608bb176 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -378,6 +378,15 @@ export function timenow() { return now.toLocaleDateString() + ' ' + h + ':' + m + ' ' + ampm; } +export function formatTime(time: number) { + time = Math.round(time); + const hours = Math.floor(time / 60 / 60); + const minutes = Math.floor(time / 60) - (hours * 60); + const seconds = time % 60; + + return hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0') + ':' + seconds.toString().padStart(2, '0'); +} + export function aggregateBounds(boundsList: { x: number, y: number, width?: number, height?: number }[], xpad: number, ypad: number) { const bounds = boundsList.map(b => ({ x: b.x, y: b.y, r: b.x + (b.width || 0), b: b.y + (b.height || 0) })).reduce((bounds, b) => ({ x: Math.min(b.x, bounds.x), y: Math.min(b.y, bounds.y), |