首页 > 其他 > 详细

获取微妙函数

时间:2015-05-19 16:51:04      阅读:238      评论:0      收藏:0      [点我收藏+]
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <string.h>
#include <iostream>
using namespace std;
char *GetTime(char *pszTime)
{
    char szTempTime[222] = {0};
    time_t t   = time(NULL);
    struct tm * Local = localtime(&t);
    struct timeval tvTime;
    gettimeofday(&tvTime, NULL);
    //sprintf(szTempTime,"%02d %02d:%02d:%02d:%06d",Local->tm_mday,Local->tm_hour,Local->      tm_min,Local->tm_sec,tvTime.tv_usec);
    sprintf(pszTime,"%d",tvTime.tv_usec);
    printf("---v_s=[%s]\n",pszTime);
    return pszTime;  
}
int main()
{
    char szTime[20];
    memset(szTime,0x00,sizeof(szTime));
    printf("获取的 微妙=[%s]\n",GetTime(szTime));
    return 0;
}

获取微妙函数

原文:http://ayang.blog.51cto.com/4224455/1652810

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!