How Long Is A .NET DateTime - TimeSpan Tick - Stack Overflow
How Long Is A .NET DateTime - TimeSpan Tick - Stack Overflow
Asked 14 years, 10 months ago Modified 8 years, 11 months ago Viewed 32k times
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)
79
Share Improve this answer Follow answered Jun 5, 2009 at 15:38
jerryjvl
19.9k 7 40 55
9 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. – Jason Kresowaty Jun 5, 2009 at 17:17
Example creating a 10 second timespan: new TimeSpan(TimeSpan.TicksPerSecond * 10) – nedstark179 May 14, 2021 at 12:48
The tick is the unit of granularity for the .NET DateTime and TimeSpan value types.
Share Improve this answer Follow edited Dec 28, 2013 at 21:48 answered Jun 5, 2009 at 15:26
Colonel Panic Jason Kresowaty
135k 94 409 470 16.3k 9 58 84
2 You answered your own question one minute after posting it? – Lance McNearney Jun 5, 2009 at 16:24
41 uh, StackOverflow encourages this sort of thing in the FAQ, dont down vote him for that. see: stackoverflow.com/questions/18557/… – Allen Rice Jun 5, 2009 at
16:46
To quote MSDN:
13 The smallest unit of time is the tick, which is equal to 100 nanoseconds.
Metrology fail.
Share Improve this answer Follow edited Sep 26, 2012 at 18:47 answered Mar 28, 2012 at 15:36
Colonel Panic
135k 94 409 470
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.
8 Apparently, on modern systems, DateTime.Now has a resolution of 10 milliseconds... See msdn.microsoft.com/en-
us/library/system.datetime.now.aspx
Share Improve this answer Follow edited May 8, 2015 at 15:25 answered Jan 28, 2011 at 0:37
Community Bot utunga
1 1 478 5 15