Differences From
Artifact [43eaf4251e]:
- File
mods/vtlib/math.lua
— part of check-in
[953151446f]
at
2024-05-05 19:31:39
on branch trunk
— better alarm LEDs, continue work on matter compiler UI, hack around gravitational horrorscape (i.e. stop shitting all over the server's `minetest.conf`), better stat interface, tweak some compute stats, be more generous with starting battery loadout, mercilessly squash numberless bugs beneath my jackbooted heel
(user:
lexi,
size: 4436)
[annotate]
[blame]
[check-ins using]
156 156 -- function fn.vlerp
157 157
158 158 function fn.timespec(n)
159 159 if n == 0 then return '0s' end
160 160 if n < 0 then return '-' .. fn.timespec(n*-1) end
161 161
162 162 local sec = math.floor(n % 60)
163 - local hr = math.floor(n / 60)
163 + local min = math.floor(n / 60)
164 + local hr = math.floor(min / 60)
164 165 local spec = {}
165 166
166 167 if hr ~= 0 then table.insert(spec, string.format("%shr", hr)) end
168 + if min ~= 0 then table.insert(spec, string.format("%sm", min)) end
167 169 if sec ~= 0 then table.insert(spec, string.format("%ss", sec)) end
168 170 return table.concat(spec, ' ')
169 171 end
170 172 return fn