#include <sys/timeb.h> time_t tsec; _timeb tm; time(&tsec); _ftime(&tm); x = (float)(tsec + 0.001 * tm.millitm);