struct timeval nowTime; gettimeofday(&nowTime,NULL); unsigned long iTime = (nowTime.tv_sec*1000+nowTime.tv_usec/1000);