C语言time函数
在unix/Linux系統(tǒng)中,時(shí)間的表示方法是以1970年1月1日00:00:00所經(jīng)過的秒數(shù),使用基本系統(tǒng)數(shù)據(jù)類型time_t表示,在/usr/include下查找time_t類型的定義.
可以通過time()函數(shù)來(lái)獲得計(jì)算機(jī)系統(tǒng)當(dāng)前的日歷時(shí)間(Calendar Time),處理日期時(shí)間的函數(shù)都是以本函數(shù)的返回值為基礎(chǔ)進(jìn)行運(yùn)算。其原型為:time_t time(time_t * t); 如果你已經(jīng)聲明了參數(shù)t,你可以從參數(shù)t返回現(xiàn)在的日歷時(shí)間,同時(shí)也可以通過返回值返回現(xiàn)在的日歷時(shí)間,即從一個(gè)時(shí)間點(diǎn)(例如:1970年1月1日0時(shí)0分0秒)到現(xiàn)在此時(shí)的秒數(shù)。如果參數(shù)為空(NULL),函數(shù)將只通過返回值返回現(xiàn)在的日歷時(shí)間。
比如下面這個(gè)例子用來(lái)顯示當(dāng)前的日歷時(shí)間: #include<stdio.h> #include<time.h> int main() {time_t t; //time for secondsint d; //time for daysint y; //time for yearst=time(NULL);printf("The number of seconds since January 1,1970 is %d\n",t);d=t/(3600*24);printf("The number of days since January 1,1970 is %d\n",d);y=d/365;printf("The number of years since January 1,1970 is %d\n",y);y=y+1970;printf("This year is %d\n",y);return 0; }
可以得到運(yùn)行結(jié)果:
1. sys/types.h
#define __need_timer_t
#define __need_clockid_t
#include <time.h>
2.time.h
typedef __time_t time_t;
# include <bits/types.h> ? ? ? ?/* This defines __time_t for us. ?*/
3.bits/types.h
__STD_TYPE __TIME_T_TYPE __time_t; ? ? ?/* Seconds since the Epoch. ?*/
# define __STD_TYPE ? ? ? ? ? ? __extension__ typedef
4.bits/typesizes.h
#define __TIME_T_TYPE ? ? ? ? ? __SLONGWORD_TYPE
5. bits/types.h
#define __SLONGWORD_TYPE ? ? ? ?long int
這里,基本就可以得出結(jié)論了:
__extension__ typedef long int time_t
則time_t類型的變量最大值為0x7fffffff
代碼: #include<stdio.h> #include<sys/types.h> #include<time.h> int main(void) {time_t cur_time=time(NULL), max_time=0x7fffffff,new_time=max_time+1;printf("Cur time: cur_time=0x%08x/n", cur_time);printf("/tLocal: %s", asctime(localtime(&cur_time)));printf("/tGMT : %s/n", asctime(gmtime(&cur_time)));printf("Max time: max_time=0x%08x/n", max_time);printf("/tLocal: %s", asctime(localtime(&max_time)));printf("/tGMT : %s/n", asctime(gmtime(&max_time)));printf("New time: new_time=0x%08x/n", new_time);printf("/tLocal: %s", asctime(localtime(&new_time)));printf("/tGMT : %s/n", asctime(gmtime(&new_time)));return 0; }
可以的到運(yùn)行結(jié)果:
從結(jié)果得出,32位的time_t最遲能表示到2038年1月19日 11:14:07(Asia/Shanghai時(shí)間) 或2038年1月19日 03:14:07(GMT時(shí)間),再過1秒,time_t數(shù)據(jù)將變?yōu)樨?fù)數(shù),變?yōu)?901年12月14日 04:51:44(本地時(shí)間),或1901年12月13日 20:45:52(GMT時(shí)間).
借鑒出處:?http://blog.csdn.net/zhangyang0402/archive/2010/07/18/5744475.aspx
C語(yǔ)言中time_t數(shù)據(jù)類型詳細(xì)介紹
包含文件:<time.h> #ifndef __TIME_T #define __TIME_T ? ? /* 避免重復(fù)定義 time_t */ typedef long ? ? time_t; ? ?/* 時(shí)間值time_t 為長(zhǎng)整型的別名*/ #endif 既然time_t實(shí)際上是長(zhǎng)整型(long int),用來(lái)保存從1970年1月1日0時(shí)0分0秒到現(xiàn)在時(shí)刻的秒數(shù)。到未來(lái)的某一天,從一個(gè)時(shí)間點(diǎn)(一般是1970年1月1日0時(shí)0分0秒)到那時(shí)的秒數(shù)(即日歷時(shí)間)超出了長(zhǎng)整形所能表示的數(shù)的范圍怎么辦?對(duì)time_t數(shù)據(jù)類型的值來(lái)說(shuō),它所表示的時(shí)間不能晚于2038年1月18日19時(shí)14分07秒。為了能夠表示更久遠(yuǎn)的時(shí)間,一些編譯器廠商引入了64位甚至更長(zhǎng)的整形數(shù)來(lái)保存日歷時(shí)間。比如微軟在Visual C++中采用了__time64_t數(shù)據(jù)類型來(lái)保存日歷時(shí)間,并通過_time64()函數(shù)來(lái)獲得日歷時(shí)間(而不是通過使用32位字的time()函數(shù)),這樣就可以通過該數(shù)據(jù)類型保存3001年1月1日0時(shí)0分0秒(不包括該時(shí)間點(diǎn))之前的時(shí)間。 在time.h頭文件中,我們還可以看到一些函數(shù),它們都是以time_t為參數(shù)類型或返回值類型的函數(shù): double difftime(time_t time1, time_t time0); time_t mktime(struct tm * timeptr); time_t time(time_t * timer); char * asctime(const struct tm * timeptr); char * ctime(const time_t *timer); 此外,time.h還提供了兩種不同的函數(shù)將日歷時(shí)間(一個(gè)用time_t表示的整數(shù))轉(zhuǎn)換為我們平時(shí)看到的把年月日時(shí)分秒分開顯示的時(shí)間格式tm: struct tm * gmtime(const time_t *timer); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? struct tm * localtime(const time_t * timer); 通過查閱MSDN,我們可以知道Microsoft C/C++ 7.0中時(shí)間點(diǎn)的值(time_t對(duì)象的值)是從1899年12月31日0時(shí)0分0秒到該時(shí)間點(diǎn)所經(jīng)過的秒數(shù),而其它各種版本的Microsoft C/C++和所有不同版本的Visual C++都是計(jì)算的從1970年1月1日0時(shí)0分0秒到該時(shí)間點(diǎn)所經(jīng)過的秒數(shù)。
C語(yǔ)言中的time函數(shù)<time.h>
/* * time.h* This file has no copyright assigned and is placed in the Public Domain.* This file is a part of the mingw-runtime package.* No warranty is given; refer to the file DISCLAIMER within the package.** Date and time functions and types.**/#ifndef _TIME_H_ #define _TIME_H_/* All the headers include this file. */ #include <_mingw.h>#define __need_wchar_t #define __need_size_t #define __need_NULL #ifndef RC_INVOKED #include <stddef.h> #endif /* Not RC_INVOKED *//** Number of clock ticks per second. A clock tick is the unit by which* processor time is measured and is returned by 'clock'.*/ #define CLOCKS_PER_SEC ((clock_t)1000) #define CLK_TCK CLOCKS_PER_SEC#ifndef RC_INVOKED/** A type for storing the current time and date. This is the number of* seconds since midnight Jan 1, 1970.* NOTE: This is also defined in non-ISO sys/types.h.*/ #ifndef _TIME32_T_DEFINED typedef __int32 __time32_t; #define _TIME32_T_DEFINED #endif#ifndef __STRICT_ANSI__ /* A 64-bit time_t to get to Y3K */ #ifndef _TIME64_T_DEFINED typedef __int64 __time64_t; #define _TIME64_T_DEFINED #endif #endif#ifndef _TIME_T_DEFINED /* FIXME __STRICT_ANSI__ ! */ #if __MSVCRT_VERSION__ >= 0x0800 #ifndef _USE_32BIT_TIME_T typedef __time64_t time_t; #else typedef __time32_t time_t; #endif /* !_USE_32BIT_TIME_T */ #else typedef __time32_t time_t; #endif /* __MSVCRT_VERSION__ >= 0x0800 */ #define _TIME_T_DEFINED #endif/** A type for measuring processor time (in clock ticks).*/ #ifndef _CLOCK_T_DEFINED typedef long clock_t; #define _CLOCK_T_DEFINED #endif#ifndef _TM_DEFINED /** A structure for storing all kinds of useful information about the* current (or another) time.*/ struct tm {int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */int tm_min; /* Minutes: 0-59 */int tm_hour; /* Hours since midnight: 0-23 */int tm_mday; /* Day of the month: 1-31 */int tm_mon; /* Months *since* january: 0-11 */int tm_year; /* Years since 1900 */int tm_wday; /* Days since Sunday (0-6) */int tm_yday; /* Days since Jan. 1: 0-365 */int tm_isdst; /* +1 Daylight Savings Time, 0 No DST,* -1 don't know */ }; #define _TM_DEFINED #endif#ifdef __cplusplus extern "C" { #endif_CRTIMP clock_t __cdecl __MINGW_NOTHROW clock (void); #if __MSVCRT_VERSION__ < 0x0800 _CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*); _CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t); _CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); #endif/** These functions write to and return pointers to static buffers that may* be overwritten by other function calls. Yikes!** NOTE: localtime, and perhaps the others of the four functions grouped* below may return NULL if their argument is not 'acceptable'. Also note* that calling asctime with a NULL pointer will produce an Invalid Page* Fault and crap out your program. Guess how I know. Hint: stat called on* a directory gives 'invalid' times in st_atime etc...*/ _CRTIMP char* __cdecl __MINGW_NOTHROW asctime (const struct tm*); #if __MSVCRT_VERSION__ < 0x0800 _CRTIMP char* __cdecl __MINGW_NOTHROW ctime (const time_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t*); #endif_CRTIMP size_t __cdecl __MINGW_NOTHROW strftime (char*, size_t, const char*, const struct tm*);#ifndef __STRICT_ANSI__extern _CRTIMP void __cdecl __MINGW_NOTHROW _tzset (void);#ifndef _NO_OLDNAMES extern _CRTIMP void __cdecl __MINGW_NOTHROW tzset (void); #endif_CRTIMP char* __cdecl __MINGW_NOTHROW _strdate(char*); _CRTIMP char* __cdecl __MINGW_NOTHROW _strtime(char*);/* These require newer versions of msvcrt.dll (6.10 or higher). */ #if __MSVCRT_VERSION__ >= 0x0601 _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _time64( __time64_t*); _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _mktime64 (struct tm*); _CRTIMP char* __cdecl __MINGW_NOTHROW _ctime64 (const __time64_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _gmtime64 (const __time64_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _localtime64 (const __time64_t*); #endif /* __MSVCRT_VERSION__ >= 0x0601 *//* These require newer versions of msvcrt.dll (8.00 or higher). */ #if __MSVCRT_VERSION__ >= 0x0800 _CRTIMP __time32_t __cdecl __MINGW_NOTHROW _time32 (__time32_t*); _CRTIMP double __cdecl __MINGW_NOTHROW _difftime32 (__time32_t, __time32_t); _CRTIMP double __cdecl __MINGW_NOTHROW _difftime64 (__time64_t, __time64_t); _CRTIMP __time32_t __cdecl __MINGW_NOTHROW _mktime32 (struct tm*); _CRTIMP __time32_t __cdecl __MINGW_NOTHROW _mkgmtime32 (struct tm*); _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _mkgmtime64 (struct tm*); _CRTIMP char* __cdecl __MINGW_NOTHROW _ctime32 (const __time32_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _gmtime32 (const __time32_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _localtime32 (const __time32_t*); #ifndef _USE_32BIT_TIME_T _CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return(_time64 (_v)); } _CRTALIAS double __cdecl __MINGW_NOTHROW difftime (time_t _v1, time_t _v2) { return(_difftime64 (_v1,_v2)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return(_mktime64 (_v)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return(_mkgmtime64 (_v)); } _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime64 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime64 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime64 (_v)); } #else _CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return(_time32 (_v)); } _CRTALIAS double __cdecl __MINGW_NOTHROW difftime (time_t _v1, time_t _v2) { return(_difftime32 (_v1,_v2)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return(_mktime32 (_v)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return(_mkgmtime32 (_v)); } _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime32 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime32 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime32 (_v)); } #endif /* !_USE_32BIT_TIME_T */ #endif /* __MSVCRT_VERSION__ >= 0x0800 *//** _daylight: non zero if daylight savings time is used.* _timezone: difference in seconds between GMT and local time.* _tzname: standard/daylight savings time zone names (an array with two* elements).*/ #ifdef __MSVCRT__/* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */ extern _CRTIMP int* __cdecl __MINGW_NOTHROW __p__daylight (void); extern _CRTIMP long* __cdecl __MINGW_NOTHROW __p__timezone (void); extern _CRTIMP char** __cdecl __MINGW_NOTHROW __p__tzname (void);__MINGW_IMPORT int _daylight; __MINGW_IMPORT long _timezone; __MINGW_IMPORT char *_tzname[2];#else /* not __MSVCRT (ie. crtdll) */#ifndef __DECLSPEC_SUPPORTEDextern int* _imp___daylight_dll; extern long* _imp___timezone_dll; extern char** _imp___tzname;#define _daylight (*_imp___daylight_dll) #define _timezone (*_imp___timezone_dll) #define _tzname (*_imp___tzname)#else /* __DECLSPEC_SUPPORTED */__MINGW_IMPORT int _daylight_dll; __MINGW_IMPORT long _timezone_dll; __MINGW_IMPORT char* _tzname[2];#define _daylight _daylight_dll #define _timezone _timezone_dll#endif /* __DECLSPEC_SUPPORTED */#endif /* not __MSVCRT__ */#endif /* Not __STRICT_ANSI__ */#ifndef _NO_OLDNAMES#ifdef __MSVCRT__/* These go in the oldnames import library for MSVCRT. */ __MINGW_IMPORT int daylight; __MINGW_IMPORT long timezone; __MINGW_IMPORT char *tzname[2];#else /* not __MSVCRT__ *//* CRTDLL is royally messed up when it comes to these macros.TODO: import and alias these via oldnames import library instead of macros. */#define daylight _daylight /* NOTE: timezone not defined as macro because it would conflict withstruct timezone in sys/time.h.Also, tzname used to a be macro, but now it's in moldname. */ __MINGW_IMPORT char *tzname[2];#endif /* not __MSVCRT__ */#endif /* Not _NO_OLDNAMES */#ifndef _WTIME_DEFINED /* wide function prototypes, also declared in wchar.h */ #ifndef __STRICT_ANSI__ #ifdef __MSVCRT__ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime(const struct tm*); #if __MSVCRT_VERSION__ < 0x0800 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime(const time_t*); #endif _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate(wchar_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime(wchar_t*); #if __MSVCRT_VERSION__ >= 0x0601 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); #endif #if __MSVCRT_VERSION__ >= 0x0800 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t*); #ifndef _USE_32BIT_TIME_T _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime64 (_v)); } #else _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); } #endif #endif /* __MSVCRT_VERSION__ >= 0x0800 */ #endif /* __MSVCRT__ */ #endif /* __STRICT_ANSI__ */ _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); #define _WTIME_DEFINED #endif /* _WTIME_DEFINED */ #ifdef __cplusplus } #endif#endif /* Not RC_INVOKED */#endif /* Not _TIME_H_ */
C語(yǔ)言中兩種方式表示時(shí)間日期值time_t和struct tm類型的相互轉(zhuǎn)換 ① ? ? 使用gmtime函數(shù)或localtime函數(shù)將time_t類型的時(shí)間日期轉(zhuǎn)換為struct tm類型: 使用time函數(shù)返回的是一個(gè)long值,該值對(duì)用戶的意義不大,一般不能根據(jù)其值確定具體的年、月、日等數(shù)據(jù)。gmtime函數(shù)可以方便的對(duì)time_t類型數(shù)據(jù)進(jìn)行轉(zhuǎn)換,將其轉(zhuǎn)換為tm結(jié)構(gòu)的數(shù)據(jù)方便數(shù)據(jù)閱讀。 gmtime函數(shù)的原型如下: struct tm *gmtime(time_t *timep); localtime函數(shù)的原型如下: struct tm *localtime(time_t *timep); 將參數(shù)timep所指的time_t類型信息轉(zhuǎn)換成實(shí)際所使用的時(shí)間日期表示方法,將結(jié)果返回到結(jié)構(gòu)tm結(jié)構(gòu)類型的變量。 gmtime函數(shù)用來(lái)存放實(shí)際日期時(shí)間的結(jié)構(gòu)變量是靜態(tài)分配的,每次調(diào)用gmtime函數(shù)都將重寫該結(jié)構(gòu)變量。如果希望保存結(jié)構(gòu)變量中的內(nèi)容,必須將其復(fù)制到tm結(jié)構(gòu)的另一個(gè)變量中。 gmtime函數(shù)與localtime函數(shù)的區(qū)別: gmtime函數(shù)返回的時(shí)間日期未經(jīng)時(shí)區(qū)轉(zhuǎn)換,是UTC時(shí)間(又稱為世界時(shí)間,即格林尼治時(shí)間)。 localtime函數(shù)返回當(dāng)前時(shí)區(qū)的時(shí)間, 轉(zhuǎn)換日期時(shí)間表示形式time_t類型轉(zhuǎn)換為struct tm類型示例: #include <stdio.h> #include <time.h> #include<string.h> int main() {const char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};/*指針字符數(shù)組*/time_t t;struct tm *p;t=time(NULL);/*獲取從1970年1月1日零時(shí)到現(xiàn)在的秒數(shù),保存到變量t中*/p=gmtime(&t); /*變量t的值轉(zhuǎn)換為實(shí)際日期時(shí)間的表示格式*/printf("%d年%02d月%02d日",(1900+p->tm_year), (1+p->tm_mon),p->tm_mday);printf(" %s ", wday[p->tm_wday]);printf("%02d:%02d:%02d\n", p->tm_hour, p->tm_min, p->tm_sec);return 0; }// time(&rawtime); // 獲取時(shí)間,以秒計(jì),從1970年1月一日起算,存于rawtime // timeinfo=localtime(&rawtime); //轉(zhuǎn)為當(dāng)?shù)貢r(shí)間,tm 時(shí)間結(jié)構(gòu) // printf("The current data/time is &s ",asctime(timeinfo)); //asctime() // 轉(zhuǎn)為標(biāo)準(zhǔn)ASCII時(shí)間格式: 注意:p=gmtime(&t);此行若改為p=localtime(&t);則返回當(dāng)前時(shí)區(qū)的時(shí)間
輸出結(jié)果:
② ? ? 使用mktime函數(shù)將struct tm類型的時(shí)間日期轉(zhuǎn)換為time_t類型:
表頭文件
#include <time.h>
定義函數(shù)
time_t mktime(strcut tm * timeptr);
函數(shù)說(shuō)明
mktime()用來(lái)將參數(shù)timeptr所指的tm結(jié)構(gòu)數(shù)據(jù)轉(zhuǎn)換成從公元1970年1月1日0時(shí)0分0 秒算起至今的UTC時(shí)間所經(jīng)過的秒數(shù)。
返回值
返回經(jīng)過的秒數(shù)。
?
日期轉(zhuǎn)換為秒數(shù)示例:
#include <stdio.h> #include <time.h> #include <cstdlib> int main() {time_t t;struct tm stm;printf("請(qǐng)輸入日期時(shí)間值(按yyyy/mm/dd hh:mm:ss格式):");scanf("%d/%d/%d %d:%d:%d",&stm.tm_year,&stm.tm_mon,&stm.tm_mday,&stm.tm_hour,&stm.tm_min,&stm.tm_sec); stm.tm_year-=1900; /*年份值減去1900,得到tm結(jié)構(gòu)中保存的年份序數(shù)*/ stm.tm_mon-=1; /*月份值減去1,得到tm結(jié)構(gòu)中保存的月份序數(shù)*/ t=mktime(&stm); /* 若用戶輸入的日期時(shí)間有誤,則函數(shù)返回值為-1*/ if(-1==t) {printf("輸入的日期時(shí)間格式出錯(cuò)!\n");exit(1); } printf("1970/01/01 00:00:00~%d/%02d/%02d %02d:%02d:%02d共%d秒\n",stm.tm_year+1900,stm.tm_mon,stm.tm_mday,stm.tm_hour,stm.tm_min,stm.tm_sec,t);return 0; }
輸出結(jié)果:
其中出現(xiàn)的一些小問題: char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};/*指針字符數(shù)組*/
error:deprecated conversation from strig constant to 'char'
當(dāng)我們將一個(gè)character pointer variable 初始化成一個(gè)string literal的時(shí)候, 就會(huì)出現(xiàn)此類錯(cuò)誤。
解決方法:const ?char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};/*指針字符數(shù)組*/ 方案2:使用string:string x = "hello";? 方案3:將string literal轉(zhuǎn)型為char* 的type: char* x = (char*)"hello";
if(-1==t) { printf("輸入的日期時(shí)間格式出錯(cuò)!\n"); exit(1); }
error: ‘exit’ was not declared in this scope 的解決方法
解決方法:添加#include <cstdlib>
最后貼一篇博客 c語(yǔ)言中time函數(shù)的用法 http://blog.csdn.net/wangluojisuan/article/details/7045592/
可以通過time()函數(shù)來(lái)獲得計(jì)算機(jī)系統(tǒng)當(dāng)前的日歷時(shí)間(Calendar Time),處理日期時(shí)間的函數(shù)都是以本函數(shù)的返回值為基礎(chǔ)進(jìn)行運(yùn)算。其原型為:time_t time(time_t * t); 如果你已經(jīng)聲明了參數(shù)t,你可以從參數(shù)t返回現(xiàn)在的日歷時(shí)間,同時(shí)也可以通過返回值返回現(xiàn)在的日歷時(shí)間,即從一個(gè)時(shí)間點(diǎn)(例如:1970年1月1日0時(shí)0分0秒)到現(xiàn)在此時(shí)的秒數(shù)。如果參數(shù)為空(NULL),函數(shù)將只通過返回值返回現(xiàn)在的日歷時(shí)間。
比如下面這個(gè)例子用來(lái)顯示當(dāng)前的日歷時(shí)間: #include<stdio.h> #include<time.h> int main() {time_t t; //time for secondsint d; //time for daysint y; //time for yearst=time(NULL);printf("The number of seconds since January 1,1970 is %d\n",t);d=t/(3600*24);printf("The number of days since January 1,1970 is %d\n",d);y=d/365;printf("The number of years since January 1,1970 is %d\n",y);y=y+1970;printf("This year is %d\n",y);return 0; }
可以得到運(yùn)行結(jié)果:
1. sys/types.h
#define __need_timer_t
#define __need_clockid_t
#include <time.h>
2.time.h
typedef __time_t time_t;
# include <bits/types.h> ? ? ? ?/* This defines __time_t for us. ?*/
3.bits/types.h
__STD_TYPE __TIME_T_TYPE __time_t; ? ? ?/* Seconds since the Epoch. ?*/
# define __STD_TYPE ? ? ? ? ? ? __extension__ typedef
4.bits/typesizes.h
#define __TIME_T_TYPE ? ? ? ? ? __SLONGWORD_TYPE
5. bits/types.h
#define __SLONGWORD_TYPE ? ? ? ?long int
這里,基本就可以得出結(jié)論了:
__extension__ typedef long int time_t
則time_t類型的變量最大值為0x7fffffff
代碼: #include<stdio.h> #include<sys/types.h> #include<time.h> int main(void) {time_t cur_time=time(NULL), max_time=0x7fffffff,new_time=max_time+1;printf("Cur time: cur_time=0x%08x/n", cur_time);printf("/tLocal: %s", asctime(localtime(&cur_time)));printf("/tGMT : %s/n", asctime(gmtime(&cur_time)));printf("Max time: max_time=0x%08x/n", max_time);printf("/tLocal: %s", asctime(localtime(&max_time)));printf("/tGMT : %s/n", asctime(gmtime(&max_time)));printf("New time: new_time=0x%08x/n", new_time);printf("/tLocal: %s", asctime(localtime(&new_time)));printf("/tGMT : %s/n", asctime(gmtime(&new_time)));return 0; }
可以的到運(yùn)行結(jié)果:
從結(jié)果得出,32位的time_t最遲能表示到2038年1月19日 11:14:07(Asia/Shanghai時(shí)間) 或2038年1月19日 03:14:07(GMT時(shí)間),再過1秒,time_t數(shù)據(jù)將變?yōu)樨?fù)數(shù),變?yōu)?901年12月14日 04:51:44(本地時(shí)間),或1901年12月13日 20:45:52(GMT時(shí)間).
借鑒出處:?http://blog.csdn.net/zhangyang0402/archive/2010/07/18/5744475.aspx
C語(yǔ)言中time_t數(shù)據(jù)類型詳細(xì)介紹
包含文件:<time.h> #ifndef __TIME_T #define __TIME_T ? ? /* 避免重復(fù)定義 time_t */ typedef long ? ? time_t; ? ?/* 時(shí)間值time_t 為長(zhǎng)整型的別名*/ #endif 既然time_t實(shí)際上是長(zhǎng)整型(long int),用來(lái)保存從1970年1月1日0時(shí)0分0秒到現(xiàn)在時(shí)刻的秒數(shù)。到未來(lái)的某一天,從一個(gè)時(shí)間點(diǎn)(一般是1970年1月1日0時(shí)0分0秒)到那時(shí)的秒數(shù)(即日歷時(shí)間)超出了長(zhǎng)整形所能表示的數(shù)的范圍怎么辦?對(duì)time_t數(shù)據(jù)類型的值來(lái)說(shuō),它所表示的時(shí)間不能晚于2038年1月18日19時(shí)14分07秒。為了能夠表示更久遠(yuǎn)的時(shí)間,一些編譯器廠商引入了64位甚至更長(zhǎng)的整形數(shù)來(lái)保存日歷時(shí)間。比如微軟在Visual C++中采用了__time64_t數(shù)據(jù)類型來(lái)保存日歷時(shí)間,并通過_time64()函數(shù)來(lái)獲得日歷時(shí)間(而不是通過使用32位字的time()函數(shù)),這樣就可以通過該數(shù)據(jù)類型保存3001年1月1日0時(shí)0分0秒(不包括該時(shí)間點(diǎn))之前的時(shí)間。 在time.h頭文件中,我們還可以看到一些函數(shù),它們都是以time_t為參數(shù)類型或返回值類型的函數(shù): double difftime(time_t time1, time_t time0); time_t mktime(struct tm * timeptr); time_t time(time_t * timer); char * asctime(const struct tm * timeptr); char * ctime(const time_t *timer); 此外,time.h還提供了兩種不同的函數(shù)將日歷時(shí)間(一個(gè)用time_t表示的整數(shù))轉(zhuǎn)換為我們平時(shí)看到的把年月日時(shí)分秒分開顯示的時(shí)間格式tm: struct tm * gmtime(const time_t *timer); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? struct tm * localtime(const time_t * timer); 通過查閱MSDN,我們可以知道Microsoft C/C++ 7.0中時(shí)間點(diǎn)的值(time_t對(duì)象的值)是從1899年12月31日0時(shí)0分0秒到該時(shí)間點(diǎn)所經(jīng)過的秒數(shù),而其它各種版本的Microsoft C/C++和所有不同版本的Visual C++都是計(jì)算的從1970年1月1日0時(shí)0分0秒到該時(shí)間點(diǎn)所經(jīng)過的秒數(shù)。
C語(yǔ)言中的time函數(shù)<time.h>
/* * time.h* This file has no copyright assigned and is placed in the Public Domain.* This file is a part of the mingw-runtime package.* No warranty is given; refer to the file DISCLAIMER within the package.** Date and time functions and types.**/#ifndef _TIME_H_ #define _TIME_H_/* All the headers include this file. */ #include <_mingw.h>#define __need_wchar_t #define __need_size_t #define __need_NULL #ifndef RC_INVOKED #include <stddef.h> #endif /* Not RC_INVOKED *//** Number of clock ticks per second. A clock tick is the unit by which* processor time is measured and is returned by 'clock'.*/ #define CLOCKS_PER_SEC ((clock_t)1000) #define CLK_TCK CLOCKS_PER_SEC#ifndef RC_INVOKED/** A type for storing the current time and date. This is the number of* seconds since midnight Jan 1, 1970.* NOTE: This is also defined in non-ISO sys/types.h.*/ #ifndef _TIME32_T_DEFINED typedef __int32 __time32_t; #define _TIME32_T_DEFINED #endif#ifndef __STRICT_ANSI__ /* A 64-bit time_t to get to Y3K */ #ifndef _TIME64_T_DEFINED typedef __int64 __time64_t; #define _TIME64_T_DEFINED #endif #endif#ifndef _TIME_T_DEFINED /* FIXME __STRICT_ANSI__ ! */ #if __MSVCRT_VERSION__ >= 0x0800 #ifndef _USE_32BIT_TIME_T typedef __time64_t time_t; #else typedef __time32_t time_t; #endif /* !_USE_32BIT_TIME_T */ #else typedef __time32_t time_t; #endif /* __MSVCRT_VERSION__ >= 0x0800 */ #define _TIME_T_DEFINED #endif/** A type for measuring processor time (in clock ticks).*/ #ifndef _CLOCK_T_DEFINED typedef long clock_t; #define _CLOCK_T_DEFINED #endif#ifndef _TM_DEFINED /** A structure for storing all kinds of useful information about the* current (or another) time.*/ struct tm {int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */int tm_min; /* Minutes: 0-59 */int tm_hour; /* Hours since midnight: 0-23 */int tm_mday; /* Day of the month: 1-31 */int tm_mon; /* Months *since* january: 0-11 */int tm_year; /* Years since 1900 */int tm_wday; /* Days since Sunday (0-6) */int tm_yday; /* Days since Jan. 1: 0-365 */int tm_isdst; /* +1 Daylight Savings Time, 0 No DST,* -1 don't know */ }; #define _TM_DEFINED #endif#ifdef __cplusplus extern "C" { #endif_CRTIMP clock_t __cdecl __MINGW_NOTHROW clock (void); #if __MSVCRT_VERSION__ < 0x0800 _CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*); _CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t); _CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); #endif/** These functions write to and return pointers to static buffers that may* be overwritten by other function calls. Yikes!** NOTE: localtime, and perhaps the others of the four functions grouped* below may return NULL if their argument is not 'acceptable'. Also note* that calling asctime with a NULL pointer will produce an Invalid Page* Fault and crap out your program. Guess how I know. Hint: stat called on* a directory gives 'invalid' times in st_atime etc...*/ _CRTIMP char* __cdecl __MINGW_NOTHROW asctime (const struct tm*); #if __MSVCRT_VERSION__ < 0x0800 _CRTIMP char* __cdecl __MINGW_NOTHROW ctime (const time_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t*); #endif_CRTIMP size_t __cdecl __MINGW_NOTHROW strftime (char*, size_t, const char*, const struct tm*);#ifndef __STRICT_ANSI__extern _CRTIMP void __cdecl __MINGW_NOTHROW _tzset (void);#ifndef _NO_OLDNAMES extern _CRTIMP void __cdecl __MINGW_NOTHROW tzset (void); #endif_CRTIMP char* __cdecl __MINGW_NOTHROW _strdate(char*); _CRTIMP char* __cdecl __MINGW_NOTHROW _strtime(char*);/* These require newer versions of msvcrt.dll (6.10 or higher). */ #if __MSVCRT_VERSION__ >= 0x0601 _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _time64( __time64_t*); _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _mktime64 (struct tm*); _CRTIMP char* __cdecl __MINGW_NOTHROW _ctime64 (const __time64_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _gmtime64 (const __time64_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _localtime64 (const __time64_t*); #endif /* __MSVCRT_VERSION__ >= 0x0601 *//* These require newer versions of msvcrt.dll (8.00 or higher). */ #if __MSVCRT_VERSION__ >= 0x0800 _CRTIMP __time32_t __cdecl __MINGW_NOTHROW _time32 (__time32_t*); _CRTIMP double __cdecl __MINGW_NOTHROW _difftime32 (__time32_t, __time32_t); _CRTIMP double __cdecl __MINGW_NOTHROW _difftime64 (__time64_t, __time64_t); _CRTIMP __time32_t __cdecl __MINGW_NOTHROW _mktime32 (struct tm*); _CRTIMP __time32_t __cdecl __MINGW_NOTHROW _mkgmtime32 (struct tm*); _CRTIMP __time64_t __cdecl __MINGW_NOTHROW _mkgmtime64 (struct tm*); _CRTIMP char* __cdecl __MINGW_NOTHROW _ctime32 (const __time32_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _gmtime32 (const __time32_t*); _CRTIMP struct tm* __cdecl __MINGW_NOTHROW _localtime32 (const __time32_t*); #ifndef _USE_32BIT_TIME_T _CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return(_time64 (_v)); } _CRTALIAS double __cdecl __MINGW_NOTHROW difftime (time_t _v1, time_t _v2) { return(_difftime64 (_v1,_v2)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return(_mktime64 (_v)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return(_mkgmtime64 (_v)); } _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime64 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime64 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime64 (_v)); } #else _CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return(_time32 (_v)); } _CRTALIAS double __cdecl __MINGW_NOTHROW difftime (time_t _v1, time_t _v2) { return(_difftime32 (_v1,_v2)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return(_mktime32 (_v)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return(_mkgmtime32 (_v)); } _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime32 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime32 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime32 (_v)); } #endif /* !_USE_32BIT_TIME_T */ #endif /* __MSVCRT_VERSION__ >= 0x0800 *//** _daylight: non zero if daylight savings time is used.* _timezone: difference in seconds between GMT and local time.* _tzname: standard/daylight savings time zone names (an array with two* elements).*/ #ifdef __MSVCRT__/* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */ extern _CRTIMP int* __cdecl __MINGW_NOTHROW __p__daylight (void); extern _CRTIMP long* __cdecl __MINGW_NOTHROW __p__timezone (void); extern _CRTIMP char** __cdecl __MINGW_NOTHROW __p__tzname (void);__MINGW_IMPORT int _daylight; __MINGW_IMPORT long _timezone; __MINGW_IMPORT char *_tzname[2];#else /* not __MSVCRT (ie. crtdll) */#ifndef __DECLSPEC_SUPPORTEDextern int* _imp___daylight_dll; extern long* _imp___timezone_dll; extern char** _imp___tzname;#define _daylight (*_imp___daylight_dll) #define _timezone (*_imp___timezone_dll) #define _tzname (*_imp___tzname)#else /* __DECLSPEC_SUPPORTED */__MINGW_IMPORT int _daylight_dll; __MINGW_IMPORT long _timezone_dll; __MINGW_IMPORT char* _tzname[2];#define _daylight _daylight_dll #define _timezone _timezone_dll#endif /* __DECLSPEC_SUPPORTED */#endif /* not __MSVCRT__ */#endif /* Not __STRICT_ANSI__ */#ifndef _NO_OLDNAMES#ifdef __MSVCRT__/* These go in the oldnames import library for MSVCRT. */ __MINGW_IMPORT int daylight; __MINGW_IMPORT long timezone; __MINGW_IMPORT char *tzname[2];#else /* not __MSVCRT__ *//* CRTDLL is royally messed up when it comes to these macros.TODO: import and alias these via oldnames import library instead of macros. */#define daylight _daylight /* NOTE: timezone not defined as macro because it would conflict withstruct timezone in sys/time.h.Also, tzname used to a be macro, but now it's in moldname. */ __MINGW_IMPORT char *tzname[2];#endif /* not __MSVCRT__ */#endif /* Not _NO_OLDNAMES */#ifndef _WTIME_DEFINED /* wide function prototypes, also declared in wchar.h */ #ifndef __STRICT_ANSI__ #ifdef __MSVCRT__ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime(const struct tm*); #if __MSVCRT_VERSION__ < 0x0800 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime(const time_t*); #endif _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate(wchar_t*); _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime(wchar_t*); #if __MSVCRT_VERSION__ >= 0x0601 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); #endif #if __MSVCRT_VERSION__ >= 0x0800 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime32 (const __time32_t*); #ifndef _USE_32BIT_TIME_T _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime64 (_v)); } #else _CRTALIAS wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t* _v) { return(_wctime32 (_v)); } #endif #endif /* __MSVCRT_VERSION__ >= 0x0800 */ #endif /* __MSVCRT__ */ #endif /* __STRICT_ANSI__ */ _CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); #define _WTIME_DEFINED #endif /* _WTIME_DEFINED */ #ifdef __cplusplus } #endif#endif /* Not RC_INVOKED */#endif /* Not _TIME_H_ */
C語(yǔ)言中兩種方式表示時(shí)間日期值time_t和struct tm類型的相互轉(zhuǎn)換 ① ? ? 使用gmtime函數(shù)或localtime函數(shù)將time_t類型的時(shí)間日期轉(zhuǎn)換為struct tm類型: 使用time函數(shù)返回的是一個(gè)long值,該值對(duì)用戶的意義不大,一般不能根據(jù)其值確定具體的年、月、日等數(shù)據(jù)。gmtime函數(shù)可以方便的對(duì)time_t類型數(shù)據(jù)進(jìn)行轉(zhuǎn)換,將其轉(zhuǎn)換為tm結(jié)構(gòu)的數(shù)據(jù)方便數(shù)據(jù)閱讀。 gmtime函數(shù)的原型如下: struct tm *gmtime(time_t *timep); localtime函數(shù)的原型如下: struct tm *localtime(time_t *timep); 將參數(shù)timep所指的time_t類型信息轉(zhuǎn)換成實(shí)際所使用的時(shí)間日期表示方法,將結(jié)果返回到結(jié)構(gòu)tm結(jié)構(gòu)類型的變量。 gmtime函數(shù)用來(lái)存放實(shí)際日期時(shí)間的結(jié)構(gòu)變量是靜態(tài)分配的,每次調(diào)用gmtime函數(shù)都將重寫該結(jié)構(gòu)變量。如果希望保存結(jié)構(gòu)變量中的內(nèi)容,必須將其復(fù)制到tm結(jié)構(gòu)的另一個(gè)變量中。 gmtime函數(shù)與localtime函數(shù)的區(qū)別: gmtime函數(shù)返回的時(shí)間日期未經(jīng)時(shí)區(qū)轉(zhuǎn)換,是UTC時(shí)間(又稱為世界時(shí)間,即格林尼治時(shí)間)。 localtime函數(shù)返回當(dāng)前時(shí)區(qū)的時(shí)間, 轉(zhuǎn)換日期時(shí)間表示形式time_t類型轉(zhuǎn)換為struct tm類型示例: #include <stdio.h> #include <time.h> #include<string.h> int main() {const char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};/*指針字符數(shù)組*/time_t t;struct tm *p;t=time(NULL);/*獲取從1970年1月1日零時(shí)到現(xiàn)在的秒數(shù),保存到變量t中*/p=gmtime(&t); /*變量t的值轉(zhuǎn)換為實(shí)際日期時(shí)間的表示格式*/printf("%d年%02d月%02d日",(1900+p->tm_year), (1+p->tm_mon),p->tm_mday);printf(" %s ", wday[p->tm_wday]);printf("%02d:%02d:%02d\n", p->tm_hour, p->tm_min, p->tm_sec);return 0; }// time(&rawtime); // 獲取時(shí)間,以秒計(jì),從1970年1月一日起算,存于rawtime // timeinfo=localtime(&rawtime); //轉(zhuǎn)為當(dāng)?shù)貢r(shí)間,tm 時(shí)間結(jié)構(gòu) // printf("The current data/time is &s ",asctime(timeinfo)); //asctime() // 轉(zhuǎn)為標(biāo)準(zhǔn)ASCII時(shí)間格式: 注意:p=gmtime(&t);此行若改為p=localtime(&t);則返回當(dāng)前時(shí)區(qū)的時(shí)間
輸出結(jié)果:
② ? ? 使用mktime函數(shù)將struct tm類型的時(shí)間日期轉(zhuǎn)換為time_t類型:
表頭文件
#include <time.h>
定義函數(shù)
time_t mktime(strcut tm * timeptr);
函數(shù)說(shuō)明
mktime()用來(lái)將參數(shù)timeptr所指的tm結(jié)構(gòu)數(shù)據(jù)轉(zhuǎn)換成從公元1970年1月1日0時(shí)0分0 秒算起至今的UTC時(shí)間所經(jīng)過的秒數(shù)。
返回值
返回經(jīng)過的秒數(shù)。
?
日期轉(zhuǎn)換為秒數(shù)示例:
#include <stdio.h> #include <time.h> #include <cstdlib> int main() {time_t t;struct tm stm;printf("請(qǐng)輸入日期時(shí)間值(按yyyy/mm/dd hh:mm:ss格式):");scanf("%d/%d/%d %d:%d:%d",&stm.tm_year,&stm.tm_mon,&stm.tm_mday,&stm.tm_hour,&stm.tm_min,&stm.tm_sec); stm.tm_year-=1900; /*年份值減去1900,得到tm結(jié)構(gòu)中保存的年份序數(shù)*/ stm.tm_mon-=1; /*月份值減去1,得到tm結(jié)構(gòu)中保存的月份序數(shù)*/ t=mktime(&stm); /* 若用戶輸入的日期時(shí)間有誤,則函數(shù)返回值為-1*/ if(-1==t) {printf("輸入的日期時(shí)間格式出錯(cuò)!\n");exit(1); } printf("1970/01/01 00:00:00~%d/%02d/%02d %02d:%02d:%02d共%d秒\n",stm.tm_year+1900,stm.tm_mon,stm.tm_mday,stm.tm_hour,stm.tm_min,stm.tm_sec,t);return 0; }
輸出結(jié)果:
其中出現(xiàn)的一些小問題: char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};/*指針字符數(shù)組*/
error:deprecated conversation from strig constant to 'char'
當(dāng)我們將一個(gè)character pointer variable 初始化成一個(gè)string literal的時(shí)候, 就會(huì)出現(xiàn)此類錯(cuò)誤。
解決方法:const ?char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};/*指針字符數(shù)組*/ 方案2:使用string:string x = "hello";? 方案3:將string literal轉(zhuǎn)型為char* 的type: char* x = (char*)"hello";
if(-1==t) { printf("輸入的日期時(shí)間格式出錯(cuò)!\n"); exit(1); }
error: ‘exit’ was not declared in this scope 的解決方法
解決方法:添加#include <cstdlib>
最后貼一篇博客 c語(yǔ)言中time函數(shù)的用法 http://blog.csdn.net/wangluojisuan/article/details/7045592/
總結(jié)
- 上一篇: 魅族android9更新,魅族 17 系
- 下一篇: DAV转换AVI指南