我的博客小站

【转】 C++获得系统时间,以及1970年1月1日到现在的毫秒数

 

#include <iostream>
#include <time.h>
#include <sys/timeb.h>
using namespace std;

int main()
{
    long long time_last;
    time_last = time(NULL);   
    
    cout<<time_last<<endl;    //秒数

    struct timeb t1;
    ftime(&t1);

    cout<<t1.time<<endl;    //秒数
    cout<<t1.millitm<<endl;    //毫秒数

    system("pause");
    return 0; 
}

 

posted on 2012-06-16 22:15  BIGSING  阅读(5276)  评论(0编辑  收藏  举报

导航

我的博客小站