Issue
I do lots of research but did not find any good answer.
I wanted to get the current date and time in a nanosecond.
I found that System.nanoTime()
will provide nanoseconds, but that is and system elapsed time. means it will provide a time when system up. I need to use the current date and time in a nanosecond.
I need this for avoiding duplicate of points in InfluxDB, see How does InfluxDB handle duplicate points? So when I use millisecond I am facing issues of data union. So need deciding to go with nanosecond but the problem is while generated nano the second using System.nanoTime()
did not contain current date and time data. and it give me JVM uptime which is useless for me.
Solution
Finally, Thanks for Mr. Franz Wilhelmstötter
I found one solution. using http://jenetics.io/ and Class call NanoClock.java is converting and doing the same trick that Stephen C suggested. I want to share this because it will useful for others as well. I am not able to confirm that is given precise nano time, but this trick works for me. @Ole V.V. Thanks again for your help.
Answered By - Himesh goswami
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.