#include <stdio.h> #include <malloc.h> #include <sys/time.h> int microtime(long *,double *); int main(int argc,char **argv){ long sec; double msec; char ret[100]; microtime(&sec,&msec); snprintf(ret,100,"%.8f %1d",msec,sec); printf("%s\n",ret); return 0; } int microtime(long *sec,double *msec){ struct timeval tp; if(gettimeofday((struct timeval *)&tp,NULL)==0){ (*msec)=(double)(tp.tv_usec/1000000.00); (*sec)=tp.tv_sec; if((*msec)>=1.0) (*msec)-=(long)(*msec); return 0; }else{ return 1; } }
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
설명
사용방법
코드
변경사항
2004/01/08
Recent Posts
Archive Posts
Tags