tihomir-kit / InfluxData.Net

InfluxData TICK stack .net library.
MIT License
156 stars 52 forks source link

suport time precision of nano-second #75

Open wsq003 opened 6 years ago

wsq003 commented 6 years ago

DateTime support Tick which is 0.1 macro-second. This is 10000 times better than milli-second.

Current minimal precision of "ms" is not enough. Please support precision "ns".

tihomir-kit commented 6 years ago

Will do. :) There was a PR for this, but it introduced unnecessary new classes (duplicates with 2 appended at the end) so I need to rework this and can push it to a new nuget then.

jschmidtWK commented 6 years ago

While work is being done with nanosecond-level precision, it might be beneficial to have a workaround to bridge the gap between tick and nano precision.

After some testing and unsuccessful attempts using ulong and DateTime I'm fairly certain the best way to tackle this gap is to add a secondary integer value bounded between 0-99 to account for the last two digits of nanosecond precision.

Every other attempt I made to have everything managed by a single property either ran into the MaxValue limit of ulong around year 583 or involved System.Numerics.BigInteger. The latter is doable but uncommon enough that it might not be intuitive for most users.

chuseman commented 6 years ago

Would you consider taking a dependency on Noda Time? You could make use of the Instant class throughout this library. Might make things easier in the long run.

tihomir-kit commented 6 years ago

I think I prefer what @jschmidtWK proposed. Introducing NodaTime (although I love it personally) would introduce kinda big-ish breaking changes for many people and I actually want to keep the number of 3rd party dependencies to a minimum.