cÈÕÆÚʱ¼ä
¹Ø¼ü×Ö£ºUTC£¨ÊÀ½ç±ê׼ʱ¼ä£©£¬Calendar Time£¨ÈÕÀúʱ¼ä£©£¬epoch£¨Ê±¼äµã£©£¬clock tick£¨Ê±ÖÓ¼Æʱµ¥Ôª£©
1£®¸ÅÄî
ÔÚC/C++ÖУ¬¶Ô×Ö·û´®µÄ²Ù×÷ÓкܶàÖµµÃ×¢ÒâµÄÎÊÌ⣬ͬÑù£¬C/C++¶Ôʱ¼äµÄ²Ù×÷Ò²ÓÐÐí¶àÖµµÃ´ó¼Ò×¢ÒâµÄµØ·½¡£ÏÂÃæÖ÷Òª½éÉÜÔÚC/C++ÖÐʱ¼äºÍÈÕÆÚµÄʹÓ÷½·¨.
ͨ¹ýѧϰÐí¶àC/C++¿â£¬Äã¿ÉÒÔÓкܶà²Ù×÷¡¢Ê¹ÓÃʱ¼äµÄ·½·¨¡£µ«ÔÚÕâ֮ǰÄãÐèÒªÁ˽âһЩ“ʱ¼ä”ºÍ“ÈÕÆÚ”µÄ¸ÅÄÖ÷ÒªÓÐÒÔϼ¸¸ö£º
Coordinated Universal Time£¨UTC£©£ºÐµ÷ÊÀ½çʱ£¬ÓÖ³ÆΪÊÀ½ç±ê׼ʱ¼ä£¬Ò²¾ÍÊÇ´ó¼ÒËùÊìÖªµÄ¸ñÁÖÍþÖαê׼ʱ¼ä£¨Greenwich Mean Time£¬GMT£©¡£±ÈÈ磬ÖйúÄڵصÄʱ¼äÓëUTCµÄʱ²îΪ+8£¬Ò²¾ÍÊÇUTC+8¡£ÃÀ¹úÊÇUTC-5¡£
Calendar Time£ºÈÕÀúʱ¼ä£¬ÊÇÓÓ´ÓÒ»¸ö±ê׼ʱ¼äµãµ½´ËʱµÄʱ¼ä¾¹ýµÄÃëÊý”À´±íʾµÄʱ¼ä¡£Õâ¸ö±ê׼ʱ¼äµã¶Ô²»Í¬µÄ±àÒëÆ÷À´Ëµ»áÓÐËù²»Í¬£¬µ«¶ÔÒ»¸ö±àÒëϵͳÀ´Ëµ£¬Õâ¸ö±ê׼ʱ¼äµãÊDz»±äµÄ£¬¸Ã±àÒëϵͳÖеÄʱ¼ä¶ÔÓ¦µÄÈÕÀúʱ¼ä¶¼Í¨¹ý¸Ã±ê׼ʱ¼äµãÀ´ºâÁ¿£¬ËùÒÔ¿ÉÒÔ˵ÈÕÀúʱ¼äÊÇ“Ïà¶Ôʱ¼ä”£¬µ«ÊÇÎÞÂÛÄãÔÚÄÄÒ»¸öʱÇø£¬ÔÚͬһʱ¿Ì¶Ôͬһ¸ö±ê׼ʱ¼äµãÀ´Ëµ£¬ÈÕÀúʱ¼ä¶¼ÊÇÒ»ÑùµÄ¡£
epoch£ºÊ±¼äµã¡£Ê±¼äµãÔÚ±ê×¼C/C++ÖÐÊÇÒ»¸öÕûÊý£¬ËüÓôËʱµÄʱ¼äºÍ±ê׼ʱ¼äµãÏà²îµÄÃëÊý£¨¼´ÈÕÀúʱ¼ä£©À´±íʾ¡£
clock tick£ºÊ±ÖÓ¼Æʱµ¥Ôª£¨¶ø²»°ÑËü½Ð×öʱÖӵδð´ÎÊý£©£¬Ò»¸öʱÖÓ¼Æʱµ¥ÔªµÄʱ¼ä³¤¶ÌÊÇÓÉCPU¿ØÖƵġ£Ò»¸öclock tick²»ÊÇCPUµÄÒ»¸öʱÖÓÖÜÆÚ£¬¶øÊÇC/C++µÄÒ»¸ö»ù±¾¼Æʱµ¥Î»¡£
ÎÒÃÇ¿ÉÒÔʹÓÃANSI±ê×¼¿âÖеÄtime.hÍ·Îļþ¡£Õâ¸öÍ·ÎļþÖж¨ÒåµÄʱ¼äºÍÈÕÆÚËùʹÓõķ½·¨£¬ÎÞÂÛÊÇÔڽṹ¶¨Ò壬»¹ÊÇÃüÃû£¬¶¼¾ßÓÐÃ÷ÏÔµÄCÓïÑÔ·ç¸ñ¡£ÏÂÃ棬ÎÒ½«ËµÃ÷ÔÚC/C++ÖÐÔõÑùʹÓÃÈÕÆÚµÄʱ¼ä¹¦ÄÜ¡£
2£® ¼Æʱ
C/C++ÖеļÆʱº¯ÊýÊÇclock()£¬¶øÓëÆäÏà¹ØµÄÊý¾ÝÀàÐÍÊÇclock_t¡£ÔÚMSDNÖУ¬²éµÃ¶Ôclockº¯Êý¶¨ÒåÈçÏ£º
clock_t clock( void );
Õâ¸öº¯Êý·µ»Ø´Ó“¿ªÆôÕâ¸ö³ÌÐò½ø³Ì”µ½“³ÌÐòÖе÷ÓÃclock()º¯Êý”ʱ֮¼äµÄCPUʱÖÓ¼Æʱµ¥Ôª£¨clock tick£©Êý£¬ÔÚMSDNÖгÆ֮Ϊ¹ÒÖÓʱ¼ä£¨wall-clock£©¡£ÆäÖÐclock_tÊÇÓÃÀ´±£´æʱ¼äµÄÊý¾ÝÀàÐÍ£¬ÔÚtime.hÎļþÖУ¬ÎÒÃÇ¿ÉÒÔÕÒµ½¶ÔËüµÄ¶¨Ò壺
#ifndef _CLOCK_T_DEFINED
typedef long clock_t;
#define _CLOCK_T_DEFINED
#endif
ºÜÃ÷ÏÔ£¬clock_tÊÇÒ»¸ö³¤ÕûÐÎÊý¡£ÔÚtime.hÎļþÖУ¬»¹¶¨ÒåÁËÒ»¸ö³£Á¿CLOCKS_PER_SEC£¬ËüÓÃÀ´±íʾһÃëÖÓ»áÓжàÉÙ¸öʱÖÓ¼Æʱµ¥Ôª£¬Æ䶨ÒåÈçÏ£º
#defin
Ïà¹ØÎĵµ£º
50¸öc/c++Ô´´úÂëÍøÕ¾
C/C++ÊÇ×îÖ÷ÒªµÄ±à³ÌÓïÑÔ¡£ÕâÀïÁгöÁË50ÃûÓÅÐãÍøÕ¾ºÍÍøÒ³Çåµ¥£¬ÕâЩÍøÕ¾Ìṩc/c++Ô´´úÂë¡£Õâ·ÝÇåµ¥ÌṩÁËÔ´´úÂëµÄÁ´½ÓÒÔ¼°ËüÃǵÄС˵Ã÷¡£ÎÒÒѾ¡Á¦°üÀ¨×î¼ÑµÄC/C++Ô´´úÂëµÄÍøÕ¾¡£Õâ²»ÊÇÒ»¸öÍêÕûµÄÇåµ¥£¬ÄúÓн¨Òé¿ÉÒÔÁªÏµÎÒ£¬ÎÒ½«»¶ÓÄúµÄ½¨Ò飬ÒÔ½øÒ»²½¼ÓÇ¿Õâ·½ÃæµÄÇåµ¥¡£
1¡¢http://snippets.dzone. ......
¹ØÓÚperlÖкÍCÖеÄsort»úÖÆ
£¨×ªÔØ£©
ϸ¶ÁC++ primer£¬ÖÕÓÚÀí½âÁËÒ»Ö±±È½ÏÒÉ»óµÄperlºÍCµÄsortº¯Êý»úÖÆ¡£ÎÒµ½²»ÊÇÒÉ»óËüµÄÓ÷¨£¬¶øÊǺÜÒÉ»óËüµÄÐÎʽ£¬ÎªÊ²Ã´Òª´«µÝÒ»¸ö×Ó³ÌÐòµÄÄäÃûÒýÓøøËüÄØ£¬¶øÇÒÐÎʽ»¹ºÜ¹Å¹Ö£¬Ò»¶¨ÒªÊÇ$a<$b£¬$a<=>$bÖ®ÀàµÄ¡£ÒªÇóÑϸñÇҹŹ֡£
½ñҹͻȻ¿´µ½p.384Ò³£¬¿´µ½ÊéÉ϶ÔquicksortÅÅ ......
Ò»¡¢Ê²Ã´ÊÇC/SºÍB/S
ÒªÏë¶Ô“C/S”ºÍ“B/S”¼¼Êõ·¢Õ¹±ä»¯ÓÐËùÁ˽⣬Ê×ÏȱØÐë¸ãÇå³þÈý¸öÎÊÌâ¡£
µÚÒ»¡¢Ê²Ã´ÊÇC/S½á¹¹¡£
C/S £¨Client/Server£©½á¹¹£¬¼´´ó¼ÒÊìÖªµÄ¿Í»§»úºÍ·þÎñÆ÷½á¹¹¡£ËüÊÇÈí¼þϵͳÌåϵ½á¹¹£¬Í¨¹ýËü¿ÉÒÔ³ä·ÖÀûÓÃÁ½¶ËÓ²¼þ»·¾³µÄÓÅÊÆ£¬½«ÈÎÎñºÏÀí·ÖÅäµ½Client¶ËºÍServer¶ËÀ´Ê ......
Ò»¡¢malloc()ºÍfree()µÄ»ù±¾¸ÅÄîÒÔ¼°»ù±¾Ó÷¨
1¡¢º¯ÊýÔÐͼ°ËµÃ÷
void *malloc(long NumBytes)£º¸Ãº¯Êý·ÖÅäÁËNumBytes¸ö×Ö½Ú£¬²¢·µ»ØÁËÖ¸ÏòÕâ¿éÄÚ´æµÄÖ¸Õë¡£Èç¹û·ÖÅäʧ°Ü£¬Ôò·µ»ØÒ»¸ö¿ÕÖ¸Õ루NULL£©¡£ ¹ØÓÚ·ÖÅäʧ°ÜµÄÔÒò£¬Ó¦¸ÃÓжàÖÖ£¬±ÈÈç˵¿Õ¼ä²»×ã¾ÍÊÇÒ»ÖÖ¡£
void free(void *FirstByte)£º ¸Ãº¯ÊýÊǽ«Ö®Ç°ÓÃmalloc· ......