Stopwatch in decisecond start on command

I have a puzzle game where I want the Stopwatch to start when the player makes his first movement. I do have a timer working which only counts in min:sec. Id like to count by tenth of a second as well.

 var sec : float = 0;

 var intsec : int;
 var minutes = 0;
 var seconds;
 var time;
 

function Update() {

  		startTimer=true;	
	 	sec = sec + Time.deltaTime;
 		intsec = sec;
 	
  		if(intsec < 10){
   			seconds = "0"+intsec;
  		}
  		else{
    		seconds = intsec;
  		}
 
    	if(intsec >= 60){
   			minutes++;
  			sec=0;
  		}
 
		time = minutes + ":" + seconds;
 
 	}

 function OnGUI() {

  		GUI.Label (Rect (10, 10, 100, 20), time);
 	
 }

Hello @skate4life13010 ,

I did not use your code to make timer.
I use this code.

private var startTime : float; private var restSeconds : float; private var roundedRestSeconds : int; private var displaySeconds : int;private var displayMicroSeconds : float; private var displayMinutes : int;
var countDownSeconds : int;
private var guiTime : float;

function Awake() 
{
 startTime = Time.time; 
}

function Update () 
{
	guiTime = startTime - Time.time;

}

function OnGUI () { //make sure that your time is based on when this script was first called //instead of when your game started var guiTime = Time.time - startTime;

 restSeconds = countDownSeconds - (guiTime);
 
 //display messages or whatever here -->do stuff based on your timer
 if (restSeconds == 60) {
     print ("One Minute Left");
 }
 if (restSeconds == 0) {
     print ("Time is Over");
     //do stuff here
 }
 
 //display the timer
 roundedRestSeconds = Mathf.CeilToInt(restSeconds);
 displaySeconds = roundedRestSeconds % 60;
 displayMinutes = roundedRestSeconds / 60; 
 displayMicroSeconds = ( restSeconds -  Mathf.FloorToInt(restSeconds) )*100 ;
 Debug.Log(displayMicroSeconds);
 
 var text = String.Format ("{0:00}:{1:00}:{2:00}", displayMinutes, displaySeconds,displayMicroSeconds); 
 GUI.Label (Rect (400, 25, 100, 30), text);
}

Hope it helps you.

Edit

For your script :

 var sec : float = 0;
 
  var intsec : int;
  var minutes = 0;
  var seconds;
  var miliseconds : int;

  var time ;
  
 
 function Update() {
 
//           startTimer=true;    
          sec = sec + Time.deltaTime;
          intsec = sec;
	      
	      miliseconds = (sec - intsec )* 100; // Here you can use 10 instead of 100.
	      
           if(intsec < 10){
                seconds = "0"+intsec;
           }
           else{
             seconds = intsec;
           }
  
         if(intsec >= 60){
                minutes++;
               sec=0;
           }
  
         time = minutes + ":" + seconds + ":" +miliseconds;
  
      }
 
  function OnGUI() 
  {
 
           GUI.Label (Rect (10, 10, 100, 20),  time.ToString());
      
  }