Chinaunix首页 | 论坛 | 博客
  • 博客访问: 285314
  • 博文数量: 1
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 661
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-11 21:23
文章分类

全部博文(1)

文章存档

2008年(1)

我的朋友

分类:

2008-03-11 09:13:52

在unix下获取当前时间的函数
void getCurTime(char *_cur_time)
{
 struct tm *tt2;
 struct timeval tstruct1;
 struct timezone tzp;
 gettimeofday(&tstruct1,&tzp);
 tt2 = localtime(&tstruct1.tv_sec);
 sprintf(_cur_time,"%04d%02d%02d %02d:%02d:%02d.%06d",
   tt2->tm_year+1900,tt2->tm_mon+1,tt2->tm_mday,tt2->tm_hour,tt2->tm_min,tt2->tm_sec,tstruct1.tv_usec);
}
阅读(1406) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~