How long is a .NET DateTime/TimeSpan tick?

.NetDatetimeTimeTimespan

.Net Problem Overview


How long is a .NET DateTime/TimeSpan tick?

.Net Solutions


Solution 1 - .Net

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)

Solution 2 - .Net

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

Solution 3 - .Net

To quote MSDN:

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

Metrology fail.

Solution 4 - .Net

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJason KresowatyView Question on Stackoverflow
Solution 1 - .NetjerryjvlView Answer on Stackoverflow
Solution 2 - .NetJason KresowatyView Answer on Stackoverflow
Solution 3 - .NetColonel PanicView Answer on Stackoverflow
Solution 4 - .NetutungaView Answer on Stackoverflow