文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>获取精确到毫秒的当前日期时间

获取精确到毫秒的当前日期时间

时间:2011-01-21  来源:pthis

#include <iostream>
#include
<sys/timeb.h>
#include
<time.h>
#include
<stdio.h>

using namespace std;

typedef
char * PCHAR;

void Now(PCHAR buff);

int main()
{
char buff[128];
Now(buff);

cout
<< buff << endl;
return 0;
}

void Now(PCHAR buff)
{
struct timeb tp;
struct tm *tm;

ftime(
&tp);

tm
= localtime(&tp.time);

sprintf(buff,
"%.4d-%.2d-%.2d %.2d:%.2d:%.2d.%.3d",
1900+ tm->tm_year,
1 + tm->tm_mon,
tm
->tm_yday,
tm
->tm_hour,
tm
->tm_min,
tm
->tm_sec,
tp.millitm);

}
相关阅读 更多 +
排行榜 更多 +
别惹神枪手安卓版

别惹神枪手安卓版

冒险解谜 下载
坦克战争世界

坦克战争世界

模拟经营 下载
丛林反击战

丛林反击战

飞行射击 下载