.NET DateTime/TimeSpan 的刻度是多长时间?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/956483/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:49:20  来源:igfitidea点击:

How long is a .NET DateTime/TimeSpan tick?

.netdatetimetimetimespan

提问by Jason Kresowaty

How long is a .NET DateTime/TimeSpan tick?

.NET DateTime/TimeSpan 的刻度是多长时间?

回答by jerryjvl

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)

虽然目前一个滴答是 100 纳秒,但最好不要将其作为绝对值。而是使用“ TimeSpan.TicksPerSecond”(或任何其他 TicksPerXxx 成员值)

回答by Jason Kresowaty

The tickis the unit of granularity for the .NET DateTimeand TimeSpanvalue types.

是粒度为.NET的单元的DateTime时间跨度值类型。

It has the following common conversions:

它有以下常见的转换:

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

回答by Colonel Panic

To quote MSDN:

引用MSDN

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

最小单位的时间刻度,这是等于100纳秒

Metrology fail.

计量失败。

回答by utunga

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.

请注意,虽然 DateTime.Now 的理论分辨率相当高,但分辨率(即更新频率)却低了很多。

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

显然,在现代系统上,DateTime.Now 的分辨率为 10 毫秒...请参阅msdn.microsoft.com/en-us/library/system.datetime.now.aspx