title: Google Sheets Stopwatch
body: <p>I'm trying to make a stopwatch that tracks ins and outs of staffs in Google Sheets I couldn't seem to get it to work what I would like it to do is whenever they hit IN the timer starts counting their hours then when they hit OUT the timer stops this is for when they have breaks lunch etc. this is not a normal job so I need it to work like this here is the code I have so far which only shows 00:00:01 it wouldn't continue on counting</p>
  <pre><code>var app=SpreadsheetApp;
  var seconds = 0, minutes = 0, hours = 0
    
  function timer() {
  
      seconds++;
    
      if (seconds &gt;= 60) {
          seconds = 0;
          minutes++;
          if (minutes &gt;= 60) {
              minutes = 0;
              hours++;
          }
      }
      app.getActiveSpreadsheet().getActiveCell().setValue(hours+&quot;:&quot;+minutes+&quot;:&quot;+seconds);
  }
  </code></pre>