博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年3月14日

摘要: time.h头文件中声明的各种函数和数据结构分类:c语言2010-04-10 17:45157人阅读评论(0)收藏举报1.计时函数:clock_t clock( void );clock_t 在time.h文件中定义为一个长整型: #ifndef _CLOCK_T_DEFINED typedef long clock_t; #define _CLOCK_T_DEFINED #endif2.日期和时间的数据结构: structtm{ inttm_sec; inttm_min; inttm_hour; inttm_mday; inttm_mon; inttm_year; inttm_wday; i 阅读全文

posted @ 2012-03-14 22:31 月不识己 阅读(853) 评论(0) 推荐(0) 编辑

摘要: Listing 1 time1.c - 采用不同格式输出当前的日期和时间 #include <stdio.h> #include <time.h> #define BUFSIZE 128 main() { time_t tval; struct tm *now; char buf[BUFSIZE]; char *fancy_format = "Or getting really fancy:\n" "%A, %B %d, day %j of %Y.\n" "The time is %I:%M %p."; /* 阅读全文

posted @ 2012-03-14 21:41 月不识己 阅读(819) 评论(0) 推荐(0) 编辑