posts - 58,  comments - 75,  trackbacks - 0
将tm结构的值转换为一个time_t类型的值
在32位系统中time_t是一个long。
头文件 <time.h>

time_t mktime(
   struct tm *timeptr
);
__time32_t _mktime32(
   struct tm *timeptr
);
__time64_t _mktime64(
   struct tm *timeptr
);

获得系统时间。
头文件 <time.h>
In Visual C++ 2005, time is a wrapper for _time64 and time_t is, by default, equivalent to __time64_t.
If you need to force the compiler to interpret time_t as the old 32-bit time_t, you can define _USE_32BIT_TIME_T.
This is not recommended because your application may fail after January 18, 2038; the use of this macro is not allowed on 64-bit platforms.

time_t time(
   time_t *timer
);
__time32_t _time32(
   __time32_t *timer
);
__time64_t _time64(
   __time64_t *timer
);


将时间转换成一个字符串
头文件 <time.h>

char *ctime(
   const time_t *timer
);
char *_ctime32(
   const __time32_t *timer )
;
char *_ctime64(
   const __time64_t *timer )
;
wchar_t *_wctime(
   const time_t *timer
);
wchar_t *_wctime32(
   const __time32_t *timer
);
wchar_t *_wctime64(
   const __time64_t *timer
);

将时间转换成一个字符串
是个安全的版本,用来替代上面的函数
头文件 <time.h>

errno_t ctime_s(
   char* buffer,
   size_t sizeInBytes,
   const time_t *time
);
errno_t _ctime32_s(
   char* buffer,
   size_t sizeInBytes,
   const __time32_t *time
);
errno_t _ctime64_s(
   char* buffer,
   size_t sizeInBytes,
   const __time64_t *time )
;
errno_t _wctime_s(
   wchar_t* buffer,
   size_t sizeInWords,
   const time_t *time
);
errno_t _wctime32_s(
   wchar_t* buffer,
   size_t sizeInWords,
   const __time32_t *time
);
errno_t _wctime64_s(
   wchar_t* buffer,
   size_t sizeInWords,
   const __time64_t *time
);
template <size_t size>
errno_t _ctime32_s(
   char (&buffer)[size],
   const __time32_t *time
); // C++ only
template <size_t size>
errno_t _ctime64_s(
   char (&buffer)[size],
   const __time64_t *time
); // C++ only
template <size_t size>
errno_t _wctime32_s(
   wchar_t (&buffer)[size],
   const __time32_t *time
); // C++ only
template <size_t size>
errno_t _wctime64_s(
   wchar_t (&buffer)[size],
   const __time64_t *time
); // C++ only


将时间值转换成一个结构
头文件 <time.h>

struct tm *gmtime(
   const time_t *timer
);
struct tm *_gmtime32(
   const time32_t *timer
);
struct tm *_gmtime64(
   const __time64_t *timer
);

将时间值转换成一个结构
头文件 <time.h>
同上面函数的功能,是安全版本

errno_t _gmtime_s(
   struct tm* _tm,
   const __time_t* time
);
errno_t _gmtime32_s(
   struct tm* _tm,
   const __time32_t* time
);
errno_t _gmtime64_s(
   struct tm* _tm,
   const __time64_t* time
);

将时间转换成本地时间。
头文件 <time.h>

struct tm *localtime(
   const time_t *timer
);
struct tm *_localtime32(
   const __time32_t *timer
);
struct tm *_localtime64(
   const __time64_t *timer
);

将时间转换成本地时间。
头文件 <time.h>
同上面函数的功能,是安全版本

errno_t _localtime_s(
   struct tm* _tm,
   const time_t *time
);
errno_t _localtime32_s(
   struct tm* _tm,
   const time32_t *time
);
errno_t _localtime64_s(
   struct tm* _tm,
   const _time64_t *time
);

clock函数
头文件 <time.h>
clock_t clock( void );


posted on 2007-05-22 10:00 walkspeed 阅读(3016) 评论(0)  编辑 收藏 引用 所属分类: C++语言

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理



<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

常用链接

留言簿(4)

随笔分类(64)

随笔档案(58)

文章分类(3)

文章档案(3)

相册

收藏夹(9)

C++零碎

好友

搜索

  •  

积分与排名

  • 积分 - 157898
  • 排名 - 163

最新评论

阅读排行榜

评论排行榜