views:

1292

answers:

2

How long is a .NET DateTime/TimeSpan tick?

+6  A: 

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

It has the following common conversions:

1 tick * 1E+2 = 100         nanoseconds
1 tick * 1E-1 =   0.1       microseconds
1 tick * 1E-4 =   0.0001    milliseconds
1 tick * 1E-7 =   0.0000001 seconds
binarycoder
You answered your own question one minute after posting it?
Lance McNearney
-1 badge farming
Dan Fuller
uh, StackOverflow encourages this sort of thing in the FAQ, dont down vote him for that.see: http://stackoverflow.com/questions/18557/how-does-stackoverflow-work-the-unofficial-faq#119658
Allen
+12  A: 

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)

jerryjvl
This is true. Don't hard code these in your code. However, they are absolute and will not be changed by Microsoft. The reason for this post is that sometimes one needs to do this math on a calculator and I wanted to make this chart available.
binarycoder