Player Duration to hh:mm:ss

Bill Marriott wjm at wjm.org
Mon Dec 19 21:06:18 EST 2005


Hi Garrett,

It's ok -- the example was a "subtle" indication. It really comes down to 
whether you salt something while cooking or leave it to guests to salt to 
taste, doesn't it?

> Ahhhhh.........  Ok, and now you've peaked my curiosity here.  How  would 
> I handle fractional seconds, or convert fractional seconds into 
> milliseconds?

Fractions are just passed through directly.

Try this:

ConvertSeconds(the round of XXX)
ConvertSeconds(trunc(XXX))

makes sure seconds is always a whole number. One rounds off, the other drops 
the fractional part.

ConvertSeconds(round(XXX,1))

Rounds to tenths of a second (but doesn't provide fixed digits in the 
result; even seconds will not show the decimal point or fractional part).

A millisecond is one thousandth of a second, i.e. three digits after the 
period. In this case, you would indeed modify the function, to ensure a 
fixed number of digits after the decimal. You'd pad out with zeros and then 
take the first N digits you wanted. You could even add a parameter to the 
function to dynamically specify how many digits are required.

> This is something I was going to ask soon anyway.  Because I will  want to 
> update some information every .5 seconds.  And I hadn't had  the chance to 
> see if Rev was capable of this or not.

The more updates you do, the slower your program may potentially run.

> Here's the scenario....  If a song title is too wide for the label's 
> width, I want to scroll the the title one letter at a time every .5 
> seconds so that eventually the entire title of the song has passed  before 
> the users view.

Scott Rossi recently (within last week or two) posted a link to a music 
player he built which does something like this... you might want to check it 
out. :)

Bill 






More information about the Use-livecode mailing list