On a POSIX system, see:

clock_t clock()

which returns the number of microseconds since the process was started. (Not milliseconds)

On Win32, see:
DWORD GetTickCount()