Custom timer code needs reviewing for thread safety
System.Threading.Thread.Sleep() has an accuracy (resolution) of around 15 milliseconds, and so I would stay far away from using that in your code if you need millisecond accuracy. Can you use Stopwatch instead? - this uses a high resolution timer where available, by default. You might find this post on StackOverflow here useful as well.