Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++»ñÈ¡µ±Ç°ÏµÍ³Ê±¼ä(תÔØ)


// ·½°¸— Óŵ㣺½öʹÓÃC ±ê×¼¿â£»È±µã£ºÖ»Äܾ«È·µ½Ã뼶
#include <time.h>
#include <stdio.h>
int main( void )
{
    time_t t = time(0);
    char tmp[64];
    strftime( tmp, sizeof(tmp), "%Y/%m/%d %X %A ±¾ÄêµÚ%jÌì %z",localtime(&t) );
    puts( tmp );
    return 0;
}
size_t strftime(char *strDest, size_t maxsize, const char *format, const struct tm *timeptr);
¸ù¾Ý¸ñʽ×Ö·û´®Éú³É×Ö·û´®¡£
struct tm *localtime(const time_t *timer);
È¡µÃµ±µØʱ¼ä£¬localtime»ñÈ¡µÄ½á¹ûÓɽṹtm·µ»Ø
·µ»ØµÄ×Ö·û´®¿ÉÒÔÒÀÏÂÁеĸñʽ¶ø¶¨£º
%a ÐÇÆÚ¼¸µÄËõд¡£Eg:Tue
%A ÐÇÆÚ¼¸µÄÈ«Ãû¡£ Eg: Tuesday
%b Ô·ÝÃû³ÆµÄËõд¡£
%B Ô·ÝÃû³ÆµÄÈ«Ãû¡£
%c ±¾µØ¶ËÈÕÆÚʱ¼ä½Ï¼Ñ±íʾ×Ö·û´®¡£
%d ÓÃÊý×Ö±íʾ±¾Ôµĵڼ¸Ìì ( ·¶Î§Îª 00 ÖÁ 31) ¡£ ÈÕÆÚ
%H Óà 24 СʱÖÆÊý×Ö±íʾСʱÊý (·¶Î§Îª 00 ÖÁ 23)¡£
%I Óà 12 СʱÖÆÊý×Ö±íʾСʱÊý (·¶Î§Îª 01 ÖÁ 12)¡£
%j ÒÔÊý×Ö±íʾµ±Äê¶ÈµÄµÚ¼¸Ìì ( ·¶Î§Îª 001 ÖÁ 366) ¡£
%m Ô·ݵÄÊý×Ö ( ·¶Î§ÓÉ 1 ÖÁ 12) ¡£
%M ·ÖÖÓ¡£
%p ÒÔ 'AM' »ò 'PM' ±íʾ±¾µØ¶Ëʱ¼ä¡£
%S ÃëÊý¡£
%U Êý×Ö±íʾΪ±¾Äê¶ÈµÄµÚ¼¸ÖÜ£¬µÚÒ»¸öÐÇÆÚÓɵÚÒ»¸öÖÜÈÕ¿ªÊ¼¡£
%W Êý×Ö±íʾΪ±¾Äê¶ÈµÄµÚ¼¸ÖÜ£¬µÚÒ»¸öÐÇÆÚÓɵÚÒ»¸öÖÜÒ»¿ªÊ¼¡£
%w ÓÃÊý×Ö±íʾ±¾Öܵĵڼ¸Ìì ( 0 ΪÖÜÈÕ)¡£
%x ²»º¬Ê±¼äµÄÈÕÆÚ±íʾ·¨¡£
%X ²»º¬ÈÕÆÚµÄʱ¼ä±íʾ·¨¡£ Eg: 15:26:30
%y ¶þλÊý×Ö±íʾÄê·Ý (·¶Î§ÓÉ 00 ÖÁ 99)¡£
%Y ÍêÕûµÄÄê·ÝÊý×Ö±íʾ£¬¼´ËÄλÊý¡£ Eg:2008
%Z(%z) ʱÇø»òÃû³ÆËõд¡£ Eg: Öйú±ê׼ʱ¼ä
%% % ×Ö·û¡£
// ·½°¸¶þ Óŵ㣺Äܾ«È·µ½ºÁÃ뼶£»È±µã£ºÊ¹ÓÃÁËwindows API
#include <windows.h>
#include <stdio.h>
int main( void )
{
SYSTEMTIME sys;
GetLocalTime( &sys );
printf( "%4d/%02d/%02d %02d:%02d:%02d.%03d ÐÇÆÚ%1d\n",sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute, sys.wSecond,sys.wMilliseconds,sys.wDayOfWeek);
return 0;
}
// ·½°¸Èý,Óŵ㣺ÀûÓÃϵͳº¯Êý,»¹ÄÜÐÞ¸Äϵͳʱ¼ä
// ´ËÎļþ±ØÐëÊÇc++Îļþ
#include<stdlib.h>
#include<iostream>
using namespace std;
void main()
{
    syste


Ïà¹ØÎĵµ£º

ÓïÑÔϲ°®³Ì¶È£ºC > C++ > C#

Ôø¾­ÈÏΪ£¬Ñ§ºÃCÓïÑÔ´ò±éÌìÏÂÎÞµÐÊÖ¡£ ºóÀ´·¢ÏÖΪÁËÃæÏò¶ÔÏ󣬲»µÃ²»ÓÃC++£¬ºóÀ´·¢ÏÖÃæÏò¶ÔÏó¹ûÈ»ÊǷdz£Î°´óµÄ˼Ï룡 ÔÙºóÀ´£¬´ÓVS6.0Õâ¸ö°æ±¾Ö®ºó£¬VC¾ÍÒѾ­Ã»ÓÐʲô̫´óµÄ±ä»¯ÁË£¬MFCµÈµÈ¶¼ÒѾ­Îȶ¨ÏÂÀ´ÁË£¬Î¢Èí²»ÍæÁË£¬Î¢ÈíÅܵ½.netƽ̨ÉÏÃæÈ¥ÍæÁË£¡£¡Î¢ÈíһЩеÄÓ¦Óã¬È«²¿¶¼Åܵ½.netƽ̨ÉÏÈ¥ÁË£¬VCƽ̨¸öÈ˾õµÃ¾ÍÊ£ ......

dz̸CÄÚ´æ·ÖÅä2

 ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
£¨1£© ´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ­·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄ
Õû¸öÔËÐÐÆڼ䶼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static ±äÁ¿¡£
£¨2£© ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯
ÊýÖ´ÐнáÊøʱÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ´¦ÀíÆ÷µ ......

Windows via C/C++£ºÏ̵߳ÄÖ´ÐÐʱ¼ä

¼ÆËãÏß³ÌÖ´ÐÐijÏîÈÎÎñÏûºÄµÄʱ¼äʱ£¬Ðí¶à¿ª·¢ÈËÔ±»áµ÷ÓÃGetTickCount/GetTickCount64±àдÈçϵĴúÂ룺
// Get the current time (start time)
ULONGLONG qwStartTime = GetTickCount64();
// Perform complex algorithm here
// Subtract start time from current time to get duration
ULONGLONG dwElapsedTime = Get ......

LinuxÏÂc¿ª·¢ Ö® Ïß³ÌͨÐÅ

1.Linux“Ï߳̔
     ½ø³ÌÓëÏß³ÌÖ®¼äÊÇÓÐÇø±ðµÄ£¬²»¹ýLinuxÄÚºËÖ»ÌṩÁËÇáÁ¿½ø³ÌµÄÖ§³Ö£¬Î´ÊµÏÖÏß³ÌÄ£ÐÍ¡£LinuxÊÇÒ»ÖÖ“¶à½ø³Ìµ¥Ï߳̔µÄ²Ù×÷ϵͳ¡£Linux±¾ÉíÖ»Óнø³ÌµÄ¸ÅÄ¶øÆäËùνµÄ“Ï߳̔±¾ÖÊÉÏÔÚÄÚºËÀïÈÔÈ»Êǽø³Ì¡£
     ´ó¼Ò ......

ʹÓÃC3P0Á¬½ÓMysqlµÄÒ»¸öÎÊÌâµÄ½â¾ö¹ý³Ì


×î½üµÄÒ»¸öÏîÄ¿ÔÚʹÓÃC3P0µÄÁ¬½Ó³Ø£¬Êý¾Ý¿âΪMysql¡£¿ª·¢²âÊÔûÓÐÎÊÌ⣬ÔÚÔËÐÐÖÐÿ¸öÒ»¶Î³¤µÄ¿ÕÏÐʱ¼ä¾Í³öÏÖÒì³£Communications link failure due to underlying exception:
java ´úÂë
²é¿´ÁËMysqlµÄÎĵµ£¬ÒÔ¼°Connector/JµÄÎĵµÒÔ¼°ÔÚÏß˵Ã÷·¢ÏÖ£¬³öÏÖÕâÖÖÒì³£µÄÔ­ÒòÊÇ£º
Mysql·þÎñÆ÷ĬÈϵēwait_timeout&rdquo ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ