C/C++ʱ¼äº¯ÊýµÄʹÓÃ
Ò»¡¢»ñÈ¡ÈÕÀúʱ¼ä
time_tÊǶ¨ÒåÔÚtime.hÖеÄÒ»¸öÀàÐÍ£¬±íʾһ¸öÈÕÀúʱ¼ä£¬Ò²¾ÍÊÇ´Ó1970Äê1ÔÂ1ÈÕ0ʱ0·Ö0Ãëµ½´ËʱµÄÃëÊý£¬ÔÐÍÊÇ£º
typedef long time_t; /* time value */
¿ÉÒÔ¿´³ötime_tÆäʵÊÇÒ»¸ö³¤ÕûÐÍ£¬ÓÉÓÚ³¤ÕûÐÍÄܱíʾµÄÊýÖµÓÐÏÞ£¬Òò´ËËüÄܱíʾµÄ×î³Ùʱ¼äÊÇ2038Äê1ÔÂ18ÈÕ19ʱ14·Ö07Ãë¡£
º¯Êýtime¿ÉÒÔ»ñÈ¡µ±Ç°ÈÕÀúʱ¼äʱ¼ä£¬timeµÄ¶¨Ò壺
time_t time(time_t *)
#include <iostream>
#include <time.h>
using namespace std;
int main(void)
{
time_t nowtime;
nowtime = time(NULL); //»ñÈ¡µ±Ç°Ê±¼ä
cout << nowtime << endl;
return 0;
}
Êä³ö½á¹û:1268575163
¶þ¡¢»ñÈ¡±¾µØÊ±¼ä
time_tÖ»ÊÇÒ»¸ö³¤ÕûÐÍ£¬²»·ûºÏÎÒÃǵÄʹÓÃϰ¹ß£¬ÐèҪת»»³É±¾µØÊ±¼ä£¬¾ÍÒªÓõ½tm½á¹¹£¬time.hÖнṹtmµÄÔÐÍÊÇ£º
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [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 January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
};
¿ÉÒÔ¿´³ö£¬Õâ¸ö»ú¹¹¶¨ÒåÁËÄê¡¢Ô¡¢ÈÕ¡¢Ê±¡¢·Ö¡¢Ãë¡¢ÐÇÆÚ¡¢µ±ÄêÖеÄijһÌì¡¢ÏÄÁîʱ¡£¿ÉÒÔÓÃÕâ¸ö½á¹¹ºÜ·½±ãµÄÏÔʾʱ¼ä¡£
ÓÃlocaltime»ñÈ¡µ±Ç°ÏµÍ³Ê±¼ä£¬¸Ãº¯Êý½«Ò»¸ötime_tʱ¼äת»»³Étm½á¹¹±íʾµÄʱ¼ä
Ïà¹ØÎĵµ£º
%d ¶ÌÕûÐÎ,Ò»°ãÕ¼Á½¸ö×Ö½Ú
%u ÎÞ·ûºÅ¶ÌÕûÐÎ
%ld ³¤ÕûÐÎ,Ò»°ãÕ¼Ëĸö×Ö½Ú
%c ×Ö·ûÐÍ
%s ×Ö·û´®
Ö÷ÒªÓÃÔÚÊäÈëÊä³öº¯Êý£ºscanf(),printf()Àï
\a:·äÃù£¬ÏìÁå
\b:»ØÍË£ºÏòºóÍËÒ»¸ñ
\f:»»Ò³
\n:»»ÐУ¬¹â±êµ½ÏÂÐÐÐÐÊ×
\r:»Ø³µ£¬¹â±êµ½±¾ÐÐÐÐÊ×
\t:Ë®Æ½ÖÆ±í
\v:´¹Ö±ÖƱí ......
CºÍC++ÓïÑÔѧϰ×ܽá(Ò»)
֪ʶ½á¹¹:
1¡¢if,for,switch,goto
2¡¢#define,const
3¡¢Îļþ¿½±´µÄ´úÂë,¶¯Ì¬Éú³ÉÄÚ´æ,¸´ºÏ±í´ïʽ,strcpy,memcpy,sizeof
4¡¢º¯Êý²ÎÊý´«µÝ,ÄÚ´æ·ÖÅ䷽ʽ,ÄÚ´æ´íÎó±íÏÖ,mallocÓënewÇø±ð
5¡¢ÀàÖØÔØ¡¢Òþ²ØÓ븲¸ÇÇø±ð,externÎÊÌâ,º¯Êý²ÎÊýµÄȱʡ
ÖµÎÊÌâ,ºê´úÂëÓëÄÚÁªº¯ÊýÇø±ð
6¡¢¹¹ÔìºÍÎö¹ ......
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......
ΪÁËÓÃvcдһ¸ö×î¼òµ¥µÄ socket ³ÌÐò£¬»¨·ÑÁËÒ»¸öÏÂÎçµÄʱ¼ä£¬¹ý³ÌÖгöÏֵĴíÎóÓУº
'SOCKET' : illegal use of this type as an expression
syntax error : missing ';' before 'type'
syntax error : identifier 'InitWinsock' --> bool InitWinsock( ......