time - Lua 4 script to convert seconds elapsed to days, hours, minutes, seconds -


i need lua 4 script converts seconds elapsed since seconds = 0 d:hh:mm:ss formatted string. methods i've looked @ try convert number calendar date , time, need elapsed time since 0. it's okay if day value increments hundreds or thousands. how write such script?

this similar other answers, shorter. return line uses format string in display result in d:hh:mm:ss format.

function disp_time(time)   local days = floor(time/86400)   local hours = floor(mod(time, 86400)/3600)   local minutes = floor(mod(time,3600)/60)   local seconds = floor(mod(time,60))   return format("%d:%02d:%02d:%02d",days,hours,minutes,seconds) end 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -