<p>Which is the best timer approach for a C# console batch application that has to process as follows:</p>

<ol>
<li>Connect to datasources</li>
<li>process batch until timeout occurs or processing complete. "Do something with datasources"</li>
<li>stop console app gracefully.</li>
</ol>

<p>related question: <a href="https://stackoverflow.com/questions/186084/how-do-you-add-a-timer-to-a-c-console-application">How do you add a timer to a C# console application</a></p>

When you say "until timeout occurs" do you mean "keep processing for an hour and then stop"? If so, I'd probably just make it very explicit - work out at the start when you want to finish, then in your processing loop, do a check for whether you've reached that time or not. It's incredibly simple, easy to test etc. In terms of testability, you may want a fake clock which would let you programmatically set the time.
EDIT: Here's some pseudocode to try to clarify:
```
```
List<DataSource> dataSources = ConnectToDataSources();
TimeSpan timeout = GetTimeoutFromConfiguration(); // Or have it passed in!
DateTime endTime = DateTime.UtcNow + timeout;

bool finished = false;
while (DateTime.UtcNow < endTime && !finished)
{
    // This method should do a small amount of work and then return
    // whether or not it's finished everything
    finished = ProcessDataSources(dataSources);
}

// Done - return up the stack and the console app will close.
```
```
That's just using the built-in clock rather than a clock interface which can be mocked, etc - but it probably makes the general appropriate simpler to understand.