I am making an XNA game and it's time to make daytime system and for that I need some kind of clock. I tried to use GameTime.TotalGameTime.Milliseconds == 0
to add one second to the second counter of my custom clock class, but it turned out that GameTime doesn't always run through zero milliseconds. Using TimeSpan prevUpdate
to compare to TotalGameTime.TotalSeconds
doesn't give enough precision, and the time is noticeably slower than the real time somehow.
What XNA or .Net component can I use to base my clock on so that it doesn't cost too much resources or deviates noticeably from real time?