linux ÏÂc++¼°mysql¶Ôʱ¼ä´¦ÀíµÄ³£Óü¼ÇÉ
mysql ½ØÈ¡Ä³Ò»¸öʱ¼ä(datetimeÀàÐÍ)µÄÈÕÆÚ£º
·½·¨1£ºselect date(row_name) from table_name where row = row1;
·½·¨2£ºselect left(row_name, 10) from table_name where row = row1;
·½·¨3£ºselect cast(row_name as char[10]) from table_name where row = row1;
È¡µÃij¸öÈÕÆÚµÄtime_tÊýÖµ£ºselect unix_timestamp(date(row_name)) from table_name where row = row1;
ÒÔtime_tΪ²ÎÊýÈ¡µÃij¸öʱ¼ä
time_t ÊÇ'1970-01-01 00:00:00'ÒÔÀ´µÄÃëÊý
select '1970-01-01 00:00:00'+ INTERVAL time_t_num SECOND ;
È¡µÃµ±Ç°ÈÕÆÚ£ºselect curdate();
È¡µÃµ±Ç°Ê±¼ä£ºselect now();
½«ÈÕÆÚת»¯Îª¶ÌÈÕÆÚ¸ñʽ
SELECT REPLACE(date(row_name), '-0', '-');
linuxÏÂc++³£ÓÃʱ¼ä´¦Àíº¯Êý
clock()ÓÃÀ´³ÌÐò¼ÆÊ±
ÀýÈ磺 ÒÔÏÂÕª×Ô
#include “stdio.h”
#include “stdlib.h”
#include “time.h”
int main( void )
{
long i = 10000000L;
clock_t start, finish;
double duration;
/* ²âÁ¿Ò»¸öʼþ³ÖÐøµÄʱ¼ä*/
printf( "Time to do %ld empty loops is ", i );
start = clock();
while( i-- ) ;
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf( "%f seconds\n", duration );
system("pause");
}
ʾÀý³ö´¦£ºDIY²¿Âä(http://www.diybl.com/course/3_program/vc/vc_js/20090307/159296.html)
time_tÀàÐÍ
time_t t = time(NULL);
time_tת³ÉtmÀàÐÍ
struct tm* t_tm = localtime(time(NULL));
time_tת³É×Ö·û´®¸ñʽ
struct tm* tm_ago = localtime(&t);
sprintf(date_days_ago, "%04d-%02d-%02d", 1900+tm_ago->tm_year,
tm_ago->tm_mon+1, tm_ago->tm_mday);
time_t t_now = time(NULL); //seconds since 1970-01-01
struct
Ïà¹ØÎĵµ£º
Ò»¡¢°²×°ÄÚºËÄ£¿é:
Ò»°ã²½Ö裺
(1) ÔÚ/usr/src/linux/ÏÂÔËÐÐmake menuconfig°ÑÐèÒª±àÒë³ÉÄ£¿éµÄÏî´òÉÏ(M)£¬±£´æ²¢Í˳ö¡£
(2) ÔËÐÐmake modules£¬ÕâÒ»²½½«ÔÚ/usr/src/linux/ÏÂÉú³É*.o»ò*.koÎļþ¡£
(3) ÔËÐÐmake modeules_installÀ´°²×°,Õâ²½»á°ÑÉú³ÉµÄ.o»òkoÎļþ¿½±´µ½/lib/modules/`uname -r`/Ï¡£
Èç¹ûÄãÖ»Òª±à ......
ÔÎĵØÖ· http://johnylai.blog.sohu.com/63406924.html
µäÐ͵ÄḬ̈߳üÀ¨Ò»¸öÔËÐÐʱ¼äϵͳ£¬Ëü¿ÉÒÔ°´Í¸Ã÷µÄ·½Ê½À´¹ÜÀíÏ̡߳£Í¨³£Ḭ̈߳ü°üÀ¨¶ÔÏ̵߳Ĵ´½¨ºÍɾ³ý£¬ÒÔ¼°¶Ô»¥³âºÍÌõ¼þ±äÁ¿µÄµ÷Óá£POSIX±ê×¼Ï߳̿â¾ßÓÐÕâЩµ÷Óá£ÕâЩ°ü»¹ÌṩÏ̵߳Ķ¯Ì¬´´½¨ºÍɾ³ý£¬Òò´Ë£¬Ö±µ½ÔËÐÐʱ¼ä֮ǰ£¬Ï̵߳ĸöÊý²»±ØÖªµÀ¡£
  ......
http://linux.chinaitlab.com/MYSQL/524755_2.html
http://bbs.chinaunix.net/archiver/?tid-809159.html
ÔÚApache, PHP,
MySQLµÄÌåϵ¼Ü¹¹ÖУ¬MySQL¶ÔÓÚÐÔÄܵÄÓ°Ïì×î´ó£¬Ò²ÊǹؼüµÄºËÐIJ¿·Ö¡£¶ÔÓÚDiscuz!ÂÛ̳³ÌÐòÒ²ÊÇÈç´Ë£¬MySQLµÄÉèÖÃÊÇ·ñºÏÀíÓÅ»¯£¬Ö±½Ó
Ó°Ïìµ½ÂÛ̳µÄËٶȺͳÐÔØÁ¿£¡Í¬Ê±£¬MySQLÒ²ÊÇÓÅ»¯ÄѶÈ×î´ó ......
select id from message where author_id in (select followed_id from Relation where follower_id=1) order by id desc ºÍ ·Ö±ðÖ´ÐÐ $userlist = select followed_id from Relation where follower_id=1 ÔÙ select id from message where author_id in ($userlist) order by id desc ¾¹È»ÓÐÁ½¸öÊýÁ ......
Ò»¡¢INSERTºÍREPLACE
INSERTºÍREPLACEÓï¾äµÄ¹¦Äܶ¼ÊÇÏò±íÖвåÈëеÄÊý¾Ý¡£ÕâÁ½ÌõÓï¾äµÄÓï·¨ÀàËÆ¡£ËüÃǵÄÖ÷񻂿±ðÊÇÈçºÎ´¦ÀíÖØ¸´µÄÊý¾Ý¡£
1. INSERTµÄÒ»°ãÓ÷¨
MySQLÖеÄINSERTÓï¾äºÍ±ê×¼µÄINSERT²»Ì«Ò»Ñù£¬ÔÚ±ê×¼µÄSQLÓï¾äÖУ¬Ò»´Î²åÈëÒ»Ìõ¼Ç¼µÄINSERTÓï¾äÖ»ÓÐÒ»ÖÖÐÎʽ¡£
INSERT INTO tablename(ÁÐÃû…) ......