I have a count down timer, when running it seems to get behind by 1 second every 5 - 10 seconds. Is there any way to make this countdown timer be accurate to system clock time?
Public MAIN()
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromMilliseconds(1000);
timer.Tick += timer_Tick;
void timer_Tick(object sender, object e)
{
basetime = basetime - 1;
txt.Text = string.Format("{0:00}:{1:00}:{2:00}", basetime / 3600, (basetime / 60) % 60, basetime % 60);
if (basetime == 0)
{
timer.Stop();
Timer_Start.IsEnabled = Timer_Pause.IsEnabled = Timer_Restart.IsEnabled = true;
}
}
i would love to try a few different ideas, also i will have to pause and start the timer periodically so will have to work that in to the solution as well.