#include<sys/time.h>
/*
struct timeval
  {
    __time_t tv_sec;		 Seconds.  秒位部分
    __suseconds_t tv_usec;	 Microseconds.  微秒位部分
  };
*/

void fn(){
    struct timeval now;
    gettimeofday(&now, NULL); //获取从1970年1月1日到现在的时间
    cout<<"当前的时间是"<<(long)now.tv_sec*1000 + (long)now.tv_usec/1000<<"毫秒"<<endl;
}

相关文章:

  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2021-10-01
  • 2021-06-30
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
相关资源
相似解决方案