Get time in milliseconds using C#

2020-05-12 06:05发布

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?

7条回答
在下西门庆
2楼-- · 2020-05-12 06:36

I used DateTime.Now.TimeOfDay.TotalMilliseconds (for current day), hope it helps you out as well.

查看更多
登录 后发表回答