庫函數(shù)調(diào)用之時(shí)間的顯示、計(jì)算、應(yīng)用

                                                            時(shí)間類型
UTC世界時(shí)間
日歷時(shí)間
從1970年1月1日
#include<stdio.h>
struct tm *gmtime(const time_t*timep)
功能;將日歷時(shí)間轉(zhuǎn)化格林威志時(shí)間;
struct tm{

創(chuàng)新互聯(lián)建站專注于慶元企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè),商城建設(shè)。慶元網(wǎng)站建設(shè)公司,為慶元等地區(qū)提供建站服務(wù)。全流程按需策劃設(shè)計(jì),專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)建站專業(yè)和態(tài)度為您提供的服務(wù)

int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year; //tm_year +1900=哪一年
int tm_wday;
int tm_yday;
int tm_isdst;

}
#include<time.h>
#include<stdio.h>
int main(void){
struct tm *local;
time_t t;
t=time(NULL);
local=localtime(&t);
printf("local hour time:%d\n",loccal->tm_hour);
local=gmtime(&t);
printf("utc hour is :%d/n",local->tm_hour);return 0;

}

獲取時(shí)間
int gettimeofday(struct timeval *tv,struct timezone tz*)
功能;獲取從今日凌晨到現(xiàn)在的時(shí)差

struct timeval{


int tv_sec; //miao
int tv_usec;//wei miao


};

#include<sys/time.h>
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

 

/************時(shí)間函數(shù),延遲函數(shù)****************/
void function()
{
 unsigned int i,j;
 double y;
 for(i=0;i<1000;i++)
 for(j=0;j<1000;j++)
 j++;

}

/*******此函數(shù)可以計(jì)算出一個(gè)函數(shù)運(yùn)行的時(shí)間********/
main()
{
struct timeval tpstart ,tpend;
float timesuel
gettimeofday(&tpstat,NULL);              // time of start
function();
gettimeofday(&tpend,NULL);              //count time end ;
/*count  time*/

timeuse=1000000*(tpend.tv_sec-tpstart.tv_set);
printf("used time ;\n",timeuse);
exit(0);
}


 

網(wǎng)頁標(biāo)題:庫函數(shù)調(diào)用之時(shí)間的顯示、計(jì)算、應(yīng)用
分享鏈接:http://muchs.cn/article14/gppcge.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護(hù)、App開發(fā)電子商務(wù)、移動(dòng)網(wǎng)站建設(shè)定制網(wǎng)站、軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)