How long is a .NET DateTime/TimeSpan tick?

前端 未结 4 445
野的像风
野的像风 2021-02-05 00:02

How long is a .NET DateTime/TimeSpan tick?

相关标签:
4条回答
  • 2021-02-05 00:15

    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
    
    0 讨论(0)
  • 2021-02-05 00:17

    To quote MSDN:

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

    Metrology fail.

    0 讨论(0)
  • 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)

    0 讨论(0)
  • 2021-02-05 00:23

    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

    0 讨论(0)
提交回复
热议问题