Is there a high resolution (microsecond, nanosecond) DateTime object available for the CLR?

前端 未结 6 1338
情深已故
情深已故 2020-12-08 05:02

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

6条回答
  •  抹茶落季
    2020-12-08 05:23

    I am struggling with this same issue, in that I have a project where I have picosecond resolution timestamps. My source data is in "time_t" format, i.e. second since epoch + picoseconds + UTC Offset.

    The best solution I have found is to work with "decimal seconds since epoch in UTC" as my time format internally, and only use DateTime as a pretty print object, to extract locale/formatting up to 1 s resolution, and then manually manipulate the string to include fractional seconds.

提交回复
热议问题