Chinaunix首页 | 论坛 | 博客
  • 博客访问: 532619
  • 博文数量: 137
  • 博客积分: 3170
  • 博客等级: 中校
  • 技术积分: 1455
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-17 11:47
文章分类

全部博文(137)

文章存档

2015年(2)

2013年(1)

2012年(6)

2011年(5)

2010年(62)

2009年(61)

我的朋友

分类: C/C++

2010-12-20 17:22:23

1.时间相关:
数据类型time_t  称为calendar time.   When interpreted as an absolute time value, it represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
数据类型tm       称为Broken-down time is stored in the structure tm which is defined in as follows:
              struct tm {
                  int tm_sec;         /* seconds */
                  int tm_min;         /* minutes */
                  int tm_hour;        /* hours */
                  int tm_mday;        /* day of the month */
                  int tm_mon;         /* month */
                  int tm_year;        /* year */
                  int tm_wday;        /* day of the week */
                  int tm_yday;        /* day in the year */
                  int tm_isdst;       /* daylight saving time */
              };
特别注意:
tm_mon和tm_year,月0~11,年指的是从1990年开始的年数

//关于localtime_r


struct tm *localtime_r(const time_t *timeval, struct tm *result);
Threadsafe: Yes,
Description
This function is the restartable version of localtime(). It is the same as localtime() except that it passes in the place to store the returned structure result.
Return Value
The localtime_r() returns a pointer to the structure result. There is no error return value.
//关于localtime
struct tm * localtime ( const time_t * timer );
***Convert time_t to tm as local time
Uses the time pointed by timer to fill a tm structure with the values that represent the corresponding local time.
2.关于无符号长整型
unsigned long long  对应printf 格式 %llu,
long long int 对应格式为 %lld
long long时,注意加后缀ll
 unsigned long long x = 0xffffffffffffffffll
%p 以16进制的形式输出地址(线性地址) -比%X输出时多0X,有时候用来打印线程号还是比较方便。


阅读(705) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-12-22 14:23:06

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com