Try using
TimeSpan instead of
DateTime when doing the computation. As someone else pointed out, one needs to cast the division so that everything works out. Here is the fixed solution with the cast.
Using your inputs:
Int32 count = 4;
TimeSpan totalOpened = new TimeSpan(0, 0, 3);
TimeSpan t = new TimeSpan((long)(totalOpened.Ticks / count));
Console.WriteLine("Avg. time open = {0:d.hh:mm:ss.ff}", t.ToString());
Times opened = 4
Total time = 3 seconds
The output will be:
Avg. time open = 00:00:00.7500000
Average time = 750 milliseconds