数据结构 :
#include <time.h>stringude ring.h>#include<stdio.h>,/*在<time.h>中定老穗义的结构体类型 struct tm
设计时间模块列表 :
TodayTime_f(Time *)/*返回当前时间、日期*/ Print_f(Time)/*打印时间 */ Input_f(Time *) /* 输入时灶绝间*/ int IsLeapYear_f(int )/*判断是否闰年*/ int FindDaysInMonth_f( int nYear, int nMon)/*
返回指定月份的天数*/ void AddDay_f(Time *strpTime, int nDay)/* 结构体变量加上天数*/ AddTime_f (Time *strpBas, Time *strpNum) /*时间相加*/ void TimeAdd_f()/* 时间相加*/ void Initial(void)/*
初始化信息*/ TodayTime_f(Time *strpTime) { time_t strCurrTime = time(0)/* 取当前时间*/ struct tm *strpCurr = localtime(&strCurrTime) 隐含姿 strpTime->nDay = strpCurr->tm_mday strpTime->nYear = (strpCurr->tm_year+1900) strpTime->nMon = strpCurr->tm_mon+1 strpTime->nSec=strpCurr->tm_sec strpTime->nMin=strpCurr->tm_min strpTime->nHour=strpCurr->tm_hour。
你试前嫌冲试下面的慧歼程序:#include
#include
#include
int
main()
{
clock_t
start,
finish
double
elapsed_time
start=clock()
//do
sonething
...
finish=clock()
elapsed_time
=
finish-start
}
我在vc++
6.0下运行,可以得到以毫秒为单者搭位的计时
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)