Well, you need a function to get the current time. You call it before the block you want to time. You call it again afterwards. Then you take the difference.

time() is a possibility, but an inaccurate one, whereas clock() is more accurate, but on some implementations only measures actual CPU time. Other than that, there's only non-portable stuff, like the *nix gettimeofday() or the Win32 GetTickCount() or timeGetTime().