The time function in time.h gives milliseconds since the epoch.
This is a simple way:
time_t seconds_since_midnight = time(NULL) % 86400;
To get approximate milliseconds since midnight, multiply seconds_since_midnight
by 1000.
If you need more resolution (consider whether you really do), you will have to use another function such as gettimeofday()
.