Question

How long is a .NET DateTime/TimeSpan tick?

Was it helpful?

Solution 2

The tick is the unit of granularity for the .NET DateTime and TimeSpan value types.

It has the following common conversions:

1 tick = 100 nanoseconds
       = 0.1 microseconds
       = 0.0001 milliseconds
       = 0.0000001 seconds

OTHER TIPS

Although currently a tick is 100 nanoseconds, it is best not to rely on this as an absolute. Rather, use 'TimeSpan.TicksPerSecond' (or any of the other TicksPerXxx member values)

To quote MSDN:

The smallest unit of time is the tick, which is equal to 100 nanoseconds.

Metrology fail.

Note that, although the theoretical resolution of DateTime.Now is quite high, the resolution - ie how often it is updated - it quite a bit lower.

Apparently, on modern systems, DateTime.Now has a resolution of 10 milliseconds... See msdn.microsoft.com/en-us/library/system.datetime.now.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top