To raise an event every hour has passed in system clock
<p>I want to raise an event every time each hour has passed in system clock.
For example, I run my program at 7:45 am then the event should be raised at 8:00 am, not at 8:45 am.
After the event raised at 8:00 am, then this event should be raised at every hour 9:00 am, 10:00 am, 11:00 am, etc...</p>

<p>Can anyone help me to show some code...
I use C#.net...
Thanks in advance...</p>

<p><strong>UPDATE:</strong></p>

<p>Now I get the simple solution for my question. Therefore I would like to share this solution. lboshuizen's answer is already correct. My answer is same logic with lboshuizen's answer but more detail and exact.</p>

<p>Firstly it needs to use Timer. Timer basically works based on milliseconds which sometimes needs additional calculation. Therefore, I would like to implement milliseconds to minute formatting function as first. </p>

<pre><code>int CalculateMillisecondUntilNextHour()
{
     int REMAIN_MINUTE = 60 - DateTime.Now.Minute;
     DateTime now = DateTime.Now;
     DateTime nexthour = now.AddMinutes((minute)).AddSeconds(now.Second * -1).AddMilliseconds(now.Millisecond * -1);

     TimeSpan interval = nexthour - now;
     return (int)interval.TotalMilliseconds;
}

void CheckEachHourPassed()
{
     System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
     t.Interval = CalculateMillisecondUntilNextHour();
     t.Tick += new EventHandler(t_Tick);
     t.Enabled = true;
}

void t_Tick(object sender, EventArgs e)
{
     MessageBox.Show("Raise Your Event");
     t.Interval = CalculateTimerInterval(REMAIN_MINUTE);
}
</code></pre>

<p>At here, the main working function is CheckEachHourPassed(). Call this function where you want to start your event scheduler. </p>
