Is there a high resolution (microsecond, nanosecond) DateTime object available for the CLR?(是否有可用于 CLR 的高分辨率(微秒、纳秒)DateTime 对象?)
问题描述
我有一个存储微秒级时间戳的仪器,我需要存储这些时间戳作为从仪器收集信息的一部分.请注意,我确实不需要生成时间戳;这些时间戳由仪器本身使用高分辨率实时操作系统预先生成.解析这些值不是问题——它们使用标准格式存储在 UTC 时间.最初我想使用 C# DateTime 结构 只能存储毫秒分辨率的时间戳.
I have an instrument that stores timestamps the microsecond level, and I need to store those timestamps as part of collecting information from the instrument. Note that I do not need to generate timestamps; these time stamps are pre-generated by the instrument itself using a high resolution real-time operating system. Parsing out these values is not an issue — they are stored using a standard format in UTC time. Originally I wanted to use the C# DateTime structure can only store time stamps up millisecond resolution.
.NET 或支持微秒和(理想情况下)纳秒分辨率时间戳的通用 C# 库是否提供了另一个对象,还是我必须自己推出?
Is there another object supplied with .NET or a common C# library that supports micro- and (ideally) nanosecond resolution timestamps, or am I going to have to roll my own?
推荐答案
毕竟你也许可以使用 DateTime
.DateTime.Ticks
的分辨率为 100 纳秒.您可以使用 DateTime.AddTicks
设置刻度.
You might be able to use DateTime
after all. DateTime.Ticks
' resolution is 100 nanoseconds. You can set the ticks with DateTime.AddTicks
.
这篇关于是否有可用于 CLR 的高分辨率(微秒、纳秒)DateTime 对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否有可用于 CLR 的高分辨率(微秒、纳秒)DateTime 对象?


- 带问号的 nvarchar 列结果 2022-01-01
- 使用 rss + c# 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01