Sarah Reichelt wrote:

I tested the suggestions and a couple of my own and couldn't find
anything faster than Wouter's suggestions, with Dick's being very
similar. I challenge for the shortest function :-)

function newTime pTime, pAdd
 set the itemDel to ":"
 add pAdd to item 3 of pTime
 convert pTime to long time
 return char -8 to -1 of ("0" & pTime)
end newTime

But it takes about the same time as the others. However re-cheking
Rob's original specs, I see he uses seconds with 1 decimal place, and
my function won't handle that :-( Wouter's won't either, so Dick's
looks like the best bet at this stage.
I challenge for shortest and fastest.
(Amazing how much it helps to be slow in replying, you get to use the best ideas from all previous entries :-)

It's one less statement than Sarah's (though more characters) so it competes for shortest.

On my machine (for 150,000),
Dick's method took 3.76 seconds
Alex's method took 2.43 seconds


function addDivandFormat pTime,pSeconds
 set the itemDelimiter to ":"
put item 1 of pTime * 3600 + item 2 of pTime * 60 + item 3 of pTime + pSeconds into tSeconds return format("%02d:%02d:%04.1f", tSeconds div 3600, tSeconds mod 3600 div 60, tSeconds mod 60)
end addDivandFormat


--
Alex Tweedly       http://www.tweedly.net



--
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.8/114 - Release Date: 28/09/2005

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to