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 对象?
基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
