Time conversion...
- Posted by leviathan at uswest.net Feb 24, 2001
- 452 views
Heya all! I wonder, is there a better way to do this function? I mean, it seems to have so much unnecessary stuff, but it gets the job done... Any advice? TIA, --"LEVIATHAN" function secs_to_mins(integer secs) atom conv atom conv2 sequence final object crap object crap2 object crap3 conv = secs / 60 --conv3 = conv crap = sprintf("%3.5f", conv) crap2 = match(".", crap) crap3 = crap[crap2..length(crap)] crap3 = value(crap3) crap3 = crap3[2] conv = conv - crap3 crap = crap[crap2+1..length(crap)] crap = value(crap) crap = crap[2] conv2 = crap * 60 conv2 = conv2 final = sprintf("%d", conv) & ":" & sprintf("%2d", conv2) crap = length(final) crap = crap - 5 final = final[1..crap] return final end function