nanosecond timer

How cam I use the precison timer in a CPU to quantify time intervals with nanosecond range accuracy? I am looking for a simple way to time laser pulses for range finding.
Who is Participating?
I think it's not a good idea to time with nanoseconds with CPU. Use specialized devices.
vvv2003Author Commented:
And you, as well.
Just out of curiosity, what is the range, resolution, and accuracy are you looking for?

Just wondering how close can we get..

Do you have a real-time clock?
How many cpu core per processor, processors, and tasks do you have running concurrently during the tests?
How do you determine the events (interrupt, polling)?
How many increments of a memory location and/or register can you do in one micro-second?
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Windows, along with Linux, is not a real time OS. No application has any guarantees when it will receive the CPU or for how long. There is really nothing that user level code can do about this. Kernel level code can disable interrupts and achieve quite good timing accuracy but this should be done only for very short time periods. Within limits and with difficulty Windows can achieve timing accuracy in the microsecond range. But no better.

For your purposes you really need external hardware.
vvv2003Author Commented:
Thank you all for your comments. Why was I directed to this website with what looked like assurance that an answer to my question was just seconds away (join....) when in fact this site did not and does not contain an answer to my original web query. At least an hour of my time was wasted dragging an inappropriate suspect onto this site.

I think there is no more reason to waste more time here. You should at least try to act professional if you put yourself out as professionals? I am not a programmer and never asked the web if there was a programming way to make the nanosecond timer. I am a physician and chemist researcher.
hmm... you asked a question and got an answer. You asked CAN I do this and we answered NO you can't. In re; "you're not a programmer", you posted this in a zone explicitly titled game PROGRAMMNG. what do you expect the experts in this zone to respond with? - programming ideas.

But I will stay professional and merely suggest that a google for nanosecond timer would yield as a first result.
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.