Since we are discussing this, here is a bit of code I've been hammering out for a time display that you can click on to switch between time elapsed, time remaining, and total length:
// PerTrack
$button2($sub(%_width%,100),2,0,0,70,30,,'
$align(center,middle)
$select($add($getpvar(time.display),1),Elapsed,Remaining,Length)
',PVAR:SET:time.display:
$ifgreater($getpvar(time.display),1,0,$add($getpvar(time.display),1))
,)
// PerSecond
$font(tahoma,18,,0-0-0)
$select($add($getpvar(time.display),1),
$puts(time.display,%playback_time_seconds%)
,
$puts(time.display,$sub(%length_seconds%,%playback_time_seconds%))
,
$puts(time.display,%length_seconds%)
)
$alignabs($sub(%_width%,100),2,70,30,right,)
$ifgreater($get(time.display),59,,00:)
$ifgreater($get(time.display),9,,0)
$cwb_hms($get(time.display))
This works but there are a few things that bug me about it. I had to add the text for the hover code because if I left it blank, the time would disappear completely on mouseover. I wanted to put the time display as the normal button code however buttons do not work under persecond and the code wont update properly anywhere else. There is a slight delay when you take the mouse off of the button until the next persecond refresh.
Anyway it uses the $cwb_hms() function as mentioned above, it will pad zeros at the beginning if the time is too short, and I figured somebody might find this useful.