title: Efficiently calculate minutes and seconds for MM:ss formatted display from seconds, using OpenLaszlo / javascript?
body: <p>I'm currently using the following function which is based on an example from the web, it is called every second to display the current progress through a video stream.</p>
  
  <p>Is there something I could do to make this more efficient?</p>
  
  <pre><code>function secondstominutes(secs){
  
  var s;
  if(secs &gt; 60){
    var min = Math.floor(secs / 60);
    s = min &lt; 10 ? "0" : "";
    s += min +":";
    secs = secs - min * 60;
  } else {
    s = "00:";
  }
  
  if(secs &lt; 10){
    s+= "0" + Math.floor(secs);
  } else {
    s += Math.floor(secs);
  }
  return s;
  }
  </code></pre>