How can I keep track of time with sub second precision. Can you guys provide me with some ideas and strategies. Also, the pros and cons of each, I am trying to implement this for a hard real-time system using a Linux kernel. The Linux clock() function is not accurate enough since its precision is by seconds.
Share
You can use
clock_gettime()to return astruct timespec:The actual resolution is typically not anywhere near nanoseconds but should get you into the millisecond range or better.