Morton Goldberg
7/25/2006 9:08:00 PM
Use quo. For example:
percomplete = timeelapsed.quo(totaltime) => 0.333333333333333
Regards, Morton
On Jul 25, 2006, at 3:05 PM, jamiethehutt wrote:
> I'm trying to make a percentage progress bar for an XMMS web
> interface,
> I want to take the total track time and the elapsed time and then make
> a length for the bar from the percentage completed.
>
> something like:
>
> totalbarsize = 180
> timeelapsed = 10
> totaltime = 30
>
> percomplete = 0.0
> barlength = 0.0
>
> percomplete = timeelapsed / totaltime
> barlength = totalbarsize*percomplete
>
> puts barlength
>
> Now that should give me a barlength of 60 pixels but it gives 0
> instead. Anyone know what I'm doing wrong?
>
> Thanks!
>
> (I'll forget that I need barlength as an integer rather than a float
> for now :-P)
>
>