Rounding numbers of a timer

Hello,

I have a simple race game that makes a car travel on 1 axis, seen from the side.

now, whenever i go across the finish, it tells the time it took.

Everything is actually working as it should, but during racing, and while showing the ending time, i want the time to be displayed like 01:23:54 for minutes, seconds and fractions.

This is my code, could anyone help me with this?

var time : float;
var finished : boolean = false;
var timer : GUIText;

function Update(){
  
  if(finished == false){
    time += Time.deltaTime;
  }
}

function OnTriggerEnter(hit : Collider){
  
  if(hit.tag == "FinishLine"){
    
    finished = true;
  }
}

function OnGUI(){
  if(finished){
    
    timer.text = "Your time was: " + Mathf.Round(time);
    
  }
  else{
    
    timer.text = Mathf.Round(time) +"";
  }
}

You could just use the .NET TimeSpan structure to get the seconds/minutes/hours like so:

TimeSpan ts = TimeSpan.FromSeconds(gameTime);
int hours = ts.Hours;
int minutes = ts.Minutes;
int seconds = ts.Seconds;
// etc

And then format the data accordingly using some String.Format() magic.