MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / runtime

Function runtime

lib/function.js:60–71  ·  view source on GitHub ↗
(seconds)

Source from the content-addressed store, hash-verified

58}
59
60const runtime = (seconds) => {
61 seconds = Number(seconds)
62 var d = Math.floor(seconds / (3600 * 24))
63 var h = Math.floor(seconds % (3600 * 24) / 3600)
64 var m = Math.floor(seconds % 3600 / 60)
65 var s = Math.floor(seconds % 60)
66 var dDisplay = d > 0 ? d + (d == 1 ? ' day, ' : ' days, ') : ''
67 var hDisplay = h > 0 ? h + (h == 1 ? ' hour, ' : ' hours, ') : ''
68 var mDisplay = m > 0 ? m + (m == 1 ? ' minute, ' : ' minutes, ') : ''
69 var sDisplay = s > 0 ? s + (s == 1 ? ' second' : ' seconds') : ''
70 return dDisplay + hDisplay + mDisplay + sDisplay;
71}
72
73const sleep = async(ms) => {
74 return new Promise(resolve => setTimeout(resolve, ms))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected