现在的位置: 首页 > 综合 > 正文

C++ 获取当前时间

2019年06月08日 ⁄ 综合 ⁄ 共 393字 ⁄ 字号 评论关闭

转自网上资料:

http://www.maeee.cn/article/it/Cjj/850/show/2009072708274542.shtml

//获取系统的当前时间
int main()
{
 time_t lTime;
//  char timeBuf[128];
//  _strtime(timeBuf);
//  printf( "OS time://t//t//t//t%s//n", timeBuf);
//  _strdate(timeBuf);
//  printf( "OS date://t//t//t//t%s//n", timeBuf);
//  return 0;

//  .................
 time(&lTime);
 int iTime = lTime;
 cout<<"the time is:"<<iTime<<endl;
 cout<<ctime(&lTime)<<endl;
 return 0;
}

 

抱歉!评论已关闭.