Get time in milliseconds using C#
问题 I'm making a program in which I need to get the time in milliseconds. By time, I mean a number that is never equal to itself, and is always 1000 numbers bigger than it was a second ago. I've tried converting DateTime.Now to a TimeSpan and getting the TotalMilliseconds from that... but I've heard it isn't perfectly accurate. Is there an easier way to do this? 回答1: Use the Stopwatch class. Provides a set of methods and properties that you can use to accurately measure elapsed time. There is