* Calculates and formats the duration for which an AMP task ran. * @param {DOMHighResTimeStamp} start * @return {string}
(start)
| 37 | * @return {string} |
| 38 | */ |
| 39 | function getTime(start) { |
| 40 | const endTime = Date.now(); |
| 41 | const executionTime = endTime - start; |
| 42 | const mins = Math.floor(executionTime / 60000); |
| 43 | const secs = Math.floor((executionTime % 60000) / 1000); |
| 44 | const msecs = executionTime % 1000; |
| 45 | return mins !== 0 |
| 46 | ? `${mins}m ${secs}s` |
| 47 | : secs != 0 |
| 48 | ? `${secs}s` |
| 49 | : `${msecs}ms`; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Switches the current directory to the repo root if needed. This is done so |