Chinaunix首页 | 论坛 | 博客
  • 博客访问: 313186
  • 博文数量: 173
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1060
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-09 16:23
文章分类

全部博文(173)

文章存档

2015年(66)

2014年(107)

我的朋友

分类: LINUX

2015-01-14 13:48:23

#include 

main()

{

time_t timep;

time (&timep);

printf(“%s”,asctime(gmtime(&timep)));

}
#include

main()

{

time_t timep;

time (&timep);

printf(“%s”,ctime(&timep));

}
#include

#include

main(){

struct timeval tv;

struct timezone tz;

gettimeofday (&tv , &tz);

printf(“tv_sec; %d\n”, tv,.tv_sec) ;

printf(“tv_usec; %d\n”,tv.tv_usec);

printf(“tz_minuteswest; %d\n”, tz.tz_minuteswest);

printf(“tz_dsttime, %d\n”,tz.tz_dsttime);

}
#include

#include

main(){

struct timeval tv;

struct timezone tz;

gettimeofday (&tv , &tz);

printf(“tv_sec; %d\n”, tv,.tv_sec) ;

printf(“tv_usec; %d\n”,tv.tv_usec);

printf(“tz_minuteswest; %d\n”, tz.tz_minuteswest);

printf(“tz_dsttime, %d\n”,tz.tz_dsttime);

}
#include

main(){

char *wday[]={“Sun”,”Mon”,”Tue”,”Wed”,”Thu”,”Fri”,”Sat”};

time_t timep;

struct tm *p;

time(&timep);

p=lotime(&timep); /*取得当地时间*/

printf (“%d%d%d ”, (1900+p->tm_year),( l+p->tm_mon), p-



>tm_mday);

printf(“%s%d:%d:%d\n”, wday[p->tm_wday],p->tm_hour, p



->tm_min, p->tm_sec);

}
#include

main()

{

time_t timep;

strcut tm *p;

time(&timep);

printf(“time() : %d \n”,timep);

p=localtime(&timep);

timep = mktime(p);

printf(“time()->localtime()->mktime():%d\n”,timep);

}
#include

main()

{

int seconds= time((time_t*)NULL);

printf(“%d\n”,seconds);

}
  • 本文来自:
阅读(694) | 评论(0) | 转发(0) |
0

上一篇:Qt5信号和槽机制

下一篇:字符串分割技术

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