Here is a portable, self-contained, short implementation of exactly what you need: https://web.archive.org/web/20151123102016/http://efesx.com/2009/08/19/portable-measurement-of-execution-time/
If the resolution isnt fine enough, you should execute your test a couple of times.