gettimeofday(struct timeval *tv, struct timezone *tz)函数
gettimeofday(struct timeval *tv, struct timezone *tz)函数
功能:获取当前精确时间(Unix时间)
其中:
timeval为时间
truct timeval{
 long tv_sec; // 秒数
 long  tv_usec; // 微秒数
 }
 
timezone为时区
#include<stdio.h>
#include<sys/time.h>
int main(){ 
struct timeval tv;
gettimeofday(&tv,NULL);
printf("%d,%d\n",tv.tv_sec,tv.tv_usec);
return 0;
}
 
 
 
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号