Like posts above, I recommend you use time.h. It's full of functions for getting the time.
Here's a reference. Nice and simple.
If you need microseconds, you can use gettimeofday() under *nix. Read the manual pages for how to use it. I can't remember how to get the time in milliseconds under Windows right now. It may come back to me later.