starlit  Diff

Differences From Artifact [557fe13815]:

To Artifact [276f7a5d6e]:


    77     77   					return string.format("%s%s%s",
    78     78   						vd, (full and (' ' .. pmin) or smin), unitForAmt(vd))
    79     79   				end
    80     80   			end
    81     81   		end
    82     82   	end
    83     83   
           84  +	if prec then val = lib.math.trim(val,prec) end
    84     85   	return string.format("%s%s", val, unitForAmt(val))
    85     86   end
    86     87   function fn.siUI(u,v,f,us,...) return fn.si(u,v,f,us,2,...) end
    87     88   
    88     89   function fn.lerp(t, a, b) return (1-t)*a + t*b end
    89     90   function fn.gradient(grad, pos)
    90     91   	local n = #grad
................................................................................
   154    155   	end;
   155    156   }
   156    157   -- function fn.vlerp
   157    158   
   158    159   function fn.timespec(n)
   159    160   	if n == 0 then return '0s' end
   160    161   	if n < 0 then return '-' .. fn.timespec(n*-1) end
          162  +	if n < 1 then return fn.siUI('s', n) end
   161    163   
   162    164   	local sec = math.floor(n % 60)
   163    165   	local min = math.floor(n / 60)
   164    166   	local hr = math.floor(min / 60)
   165    167   	min = min % 60
   166    168   	local spec = {}
   167    169   
   168    170   	if hr  ~= 0 then table.insert(spec, string.format("%shr", hr))  end
   169    171   	if min  ~= 0 then table.insert(spec, string.format("%sm", min))  end
   170    172   	if sec ~= 0 then table.insert(spec, string.format("%ss",  sec)) end
   171    173   	return table.concat(spec, ' ')
   172    174   end
   173    175   return fn