#include<stdio.h>
#include<time.h>
void main()
{
long t;
time_t s;
int i;
short e;
struct tm *ptm;
e=i=t=time(NULL);
ptm=gmtime(&t); //取地址,即参数是指针
printf("time的返回值long是:%ld/n",t);
printf("time的返回值int是:%d/n",i);
printf("time的返回值short是:%d/n",e);
printf("秒(tm_sec):%d/n",ptm->tm_sec);
printf("分(tm_min):%d/n",ptm->tm_min);
printf("时(tm_hour):%d/n",ptm->tm_hour);
printf("日(tm_mday):%d/n",ptm->tm_mday);
printf("月(tm_mon):1+%d/n",ptm->tm_mon);
printf("年(tm_year):1900+%d/n",ptm->tm_year);
printf("星期(tm_wday):%d/n",ptm->tm_wday);
printf("天数(tm_yday:%d/n",ptm->tm_yday);
printf("夏令时标志(tm_isdst):%d/n",ptm->tm_isdst);
s=mktime(ptm); //取地址,即指针
printf("time的返回值long是:%ld/n",s);
}
相关文章
- JAVA中基本类型和包装类之间的相互转换
- PIL、cv2、numpy,和pytorch(torch)之间的转换
- LocalDateTime,LocalDate,LocalTime和Date的相互转换
- 字符和字符串(13)——C#中把英文字母转换为大写或小写的方法
- String和StringBuffer的转换
- IQ信号和实信号的关系与转换的matlab实现-IQ信号转实信号
- C++智能指针父类和子类之间的转换
- java中逗号分隔的字符串和List相互转换
- Java中 Long(long) 和Integer(int)之间的强制转换
- C++ Pirmer : 第十五章 : 面向对象程序设计之基类和派生的定义、类型转换与继承与虚函数