I can't see how you could do this at all accurately without using system calls. strftime makes me happy. Even system calls aren't guaranteed to be accurate, depending on your OS's scheduler. (Though the error is likely to be so small you wouldn't notice.)

Also note, some compilers optimze away loops that don't do anything. So if you do something like

Code:
for(int c=0; c<5000000000; c++)
{ }
expecting it to take a long time, and it takes 0 seconds to run, that's probably why.