(ת)C/C++ÖÐʱ¼äº¯ÊýµÄ½éÉÜ
1£®¸ÅÄî
ÔÚC/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Ö
Ïà¹ØÎĵµ£º
http://blog.csdn.net/hwz119/archive/2007/05/25/1625218.aspx
ÄúÊÇ·ñ×ö¹ýÕâÑùÒ»¸öÏîÄ¿£¬ËüÒªÇóÄúÔÚÄÚ´æÖб£´æÊýÄ¿²»¶¨µÄÈô¸É²»Í¬¶ÔÏ󣿶ÔÓÚijЩÇé¿ö£¬¶þ²æÊ÷ÊÇ×î¼ÑÑ¡Ôñ£¬µ«ÔÚͨ³£Çé¿öÏ£¬¸ü¼òµ¥µÄÁ´±íÊÇÏÔ¶øÒ×¼ûµÄÑ¡Ôñ¡£
Ò»¸ö¼ò»¯µÄÎÊÌâʾÀý
Á´±íµÄÄѵãÔÚÓÚ±ØÐ븴ÖÆÁ´±í´¦Àíº¯ÊýÀ´´¦Àí²»Í¬µÄ¶ÔÏó ......
ż¶û¿´µ½ C Primer Plus Öн²µ½±ä³¤Êý×é(VLA)£¬ºÜÓÐÒâ˼¡£
×÷ÕßÔÚËûµÄ C Primer Plus ºÍ C++ Primer Plus ÀïÃ涼Ã÷È·Ö¸³ö£¬¶¨ÒåÊý×éʱÊý×éµÄÔªËظöÊý±ØÐëÊÇÕûÐͳ£Á¿£¬²»ÄÜÊDZäÁ¿¡£µ«ÊÇÔÚ C Õâ±¾ÊéÀï½²µ½±ä³¤Êý×é VLA£¬ÔÚ C++ ÄDZ¾ÀïÃæÓÖûÓÐÌá¡£²»ÖªµÀΪʲô£¿ÏëÀ´Ò»¶¨ÊÇ VLA ÓÃÆðÀ´ÓÐЩ²»Ì«Ã÷È·µÄµØ·½¡£
ÎÒÊÔ×ÅдÁ˸öС³ ......
1//ÓÉÓÚʹÓÃgcc±àÒ룬ËùÒÔ±àÒëʱҪÁ´½ÓÉÏc++µÄ¿â£¬ÃüÁîÊÇgcc -lstdc++ main.cpp -o main
//±¾ÎÄС³ÌÐòʵÏÖµÄÊǶÔ/home/1.avi´óСµÄ¼ÆËã¡£ºÜ¼òµ¥£¬Ìù³öÀ´Ö»ÊÇΪÁË·½±ã²»ÖªµÀµÄÅóÓÑ
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <sys/stat.h>
5 #includ ......
Ôø¾Åöµ½¹ýÈÃÄãÃԻ󲻽⡢ÀàËÆÓÚint * (* (*fp1) (int) )
[10];ÕâÑùµÄ±äÁ¿ÉùÃ÷Â𣿱¾ÎĽ«ÓÉÒ×µ½ÄÑ£¬Ò»²½Ò»²½½Ì»áÄãÈçºÎÀí½âÕâÖÖ¸´ÔÓµÄC/C++ÉùÃ÷£ºÎÒÃÇ
½«´ÓÿÌ춼ÄÜÅöµ½µÄ½Ï¼òµ¥µÄÉùÃ÷ÈëÊÖ£¬È»ºóÖð²½¼ÓÈëconstÐÞÊÎ
·ûºÍtypedef£¬»¹Óк¯ÊýÖ¸Õ룬×îºó½éÉÜÒ»¸öÄܹ»ÈÃÄã׼ȷµØÀí½âÈκÎC/C++ ......
Ç°ÑÔ:ÕâÒ»ÕÂÎÒÃÇÌÖÂÛÒ»ÏÂLinuxϵÄÐźŴ¦Àíº¯Êý.
LinuxϵÄÐźŴ¦Àíº¯Êý:
1.ÐźŵIJúÉú
2.ÐźŵĴ¦Àí
3.ÆäËüÐźź¯Êý
--------------------------------------------------------------------------------
Ò»¸öʵÀý
1¡£ÐźŵIJúÉú ......