title: Executing method every hour on the hour
body: <p>I want to execute a method every hour on the hour. I wrote some code,but it is not enough for my aim. Below code is working every 60 minutes. </p>
  
  <pre><code>public void Start()
  {
      System.Threading.Timer timerTemaUserBilgileri = new System.Threading.Timer(new System.Threading.TimerCallback(RunTakip), null, tmrTemaUserBilgileri, 0);
  }
  
  public void RunTakip(object temauserID)
  {
      try 
      {
          string objID = "6143566557387";
          EssentialMethod(objID);
          TimeSpan span = DateTime.Now.Subtract(lastRunTime);
          if (span.Minutes &gt; 60)
          {
              tmrTemaUserBilgileri = 1 * 1000;
              timerTemaUserBilgileri.Change(tmrTemaUserBilgileri, 0);
          }
          else
          {
              tmrTemaUserBilgileri = (60 - span.Minutes) * 60 * 1000;
              timerTemaUserBilgileri.Change(tmrTemaUserBilgileri, 0);
          }
          watch.Stop();
          var elapsedMs = watch.ElapsedMilliseconds;
      }
      catch (Exception ex)
      {
          timerTemaUserBilgileri.Change(30 * 60 * 1000, 0);
          Utils.LogYaz(ex.Message.ToString());
      }
  }
  
  public void EssentialMethod(objec obj)
  {
      //some code
      lastRunTime = DateTime.Now;
      //send lastruntime to sql 
  }
  </code></pre>