是否有一个高分辨率(微秒,纳秒级)DateTime对象可用于CLR? [英] Is there a high resolution (microsecond, nanosecond) DateTime object available for the CLR?

查看:938
本文介绍了是否有一个高分辨率(微秒,纳秒级)DateTime对象可用于CLR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时间戳存储微秒级的工具,我需要将这些存储的时间戳从仪器收集信息的一部分。请注意,我做的的需要产生时间戳 ;通过使用高分辨率实时操作系统仪器本身这些时间标记被预先生成。解析出这些值不是一个问题 - 它们使用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.

这篇关于是否有一个高分辨率(微秒,纳秒级)DateTime对象可用于CLR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆