2

I need to way to get a very precise measurement of current time. The tick value seems to be perfect for this, but the most common way to get it (DateTime.Now) seems to have a fairly loose tolerance (approx ~16ms from what I can tell). There are examples out there that use the StopWatch class to measure deltas using the high resolution timers, but nothing about using those same high resolution counters to measure the current time as ticks.

Is there any way to get the current time as ticks that is more precise than DateTime.Now.Ticks?

Sam
  • 7,252
  • 16
  • 46
  • 65
Erick T
  • 7,009
  • 9
  • 50
  • 85
  • 2
    You cannot get a very precise measurement of the current time without special hardware. A time source based on a GPS receiver, typically. – Hans Passant Sep 29 '11 at 14:55
  • Without some external source, your program will be at the mercy of whatever other program or person decides to muck with the system clock (daylight saving time changes, for example). – Jim Mischel Sep 29 '11 at 18:21

2 Answers2

1

See this earlier answer:

How to get timestamp of tick precision in .NET / C#?

This answer uses a running StopWatch in conjunction with DateTime.Now to give hyper-accurate timing, but it has issues (see all the comments).

Community
  • 1
  • 1
MusiGenesis
  • 74,184
  • 40
  • 190
  • 334
0

After a fair bit of research, I think that I am hosed. While I can use the methods suggested to track elapsed time, it can't be compared between machines. As MusiGenesis comments, having the high precision timer doesn't really help with what time it is.

Thanks for the answers all

Erick T
  • 7,009
  • 9
  • 50
  • 85