Can't match times in C#
<p>I've got a very simple program written in C#, but the loop never exits because the times don't match.</p>

<pre><code>static void Main(string[] args)
{
    while (System.DateTime.Now != new System.DateTime(2011, 05, 23, 22, 17, 0))
    {
    }
    System.Diagnostics.Process.Start(file);   
}
</code></pre>

<p>The idea is that when the time ticks over to the specified time, then the given file will be started. However, I've tested this program with values which are, for example, just one minute ahead of the current time as reported by Windows, and it won't start the process. I've verified that the <code>Process.Start</code> call is correct. Any suggestions?</p>

<p>Edit: No, this is not an experiment or anything of the sort. It's because I keep turning off my alarm clocks in my sleep. <code>file</code> is an mp3 file, and I'm going to leave my speakers on, and I'm pretty sure that I don't possess the capacity to deal with that in my sleep. First ever practical problem I solved with a program. As it possesses a rather specific purpose, I think you'll agree that the necessity of another solution is, well, limited.</p>

<p>Edit: I didn't realize that the DateTime type went down to that kind of precision, else I would have spotted this myself. I thought that they were only valid down to the second, and since the loop should run even in debug mode in the IDE many, many times a second, I didn't see why an exact match would be unreasonable. But, of course, if you're comparing it down to the hundred nanoseconds, it's pretty damn unlikely.</p>
