You could try that function timer although despite my claim that "while accurately timing an event in usecs is possible" I don't remember using it to do so...hmmm :p
Since the example function timer reports in microseconds, an easily called function with a granularity also in microseconds would be nice. Unfortunately, while accurately timing an event in usecs is possible, on a normal linux system scheduling latency makes it impossible to accurately ask for a delay with finer granularity than 10 milliseconds. You can test this yourself by calling nanosleep with a 10000 nanosecond (1 millisecond) delay 10000 times -- it will work out to much more than 10 seconds. However, if you ask for 100000 nsecs (1/100th second) 1000 times, you will get exactly 10 seconds.