From ef5d42566f789af3de7dd13567b06210afe74ea7 Mon Sep 17 00:00:00 2001 From: bbs Date: Wed, 7 May 2003 03:35:07 +0000 Subject: OUTTA_TIMER git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@823 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/include/pttstruct.h | 5 ++++- pttbbs/mbbsd/io.c | 6 +++++- pttbbs/sample/pttbbs.conf | 4 ++++ pttbbs/util/shmctl.c | 5 ++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pttbbs/include/pttstruct.h b/pttbbs/include/pttstruct.h index 0d60a7a5..cb60f97d 100644 --- a/pttbbs/include/pttstruct.h +++ b/pttbbs/include/pttstruct.h @@ -1,4 +1,4 @@ -/* $Id: pttstruct.h,v 1.34 2003/04/08 09:53:21 in2 Exp $ */ +/* $Id: pttstruct.h,v 1.35 2003/05/07 03:35:07 bbs Exp $ */ #ifndef INCLUDE_STRUCT_H #define INCLUDE_STRUCT_H @@ -356,6 +356,9 @@ typedef struct { int dymaxactive; /* 動態設定最大人數上限 */ int toomanyusers; /* 超過人數上限不給進的個數 */ int noonlineuser; /* 站上使用者不高亮度顯示 */ +#ifdef OUTTA_TIMER + time_t now; +#endif } e; } GV2; char gap3_2[128]; diff --git a/pttbbs/mbbsd/io.c b/pttbbs/mbbsd/io.c index 3e8f79a7..3b15bbe7 100644 --- a/pttbbs/mbbsd/io.c +++ b/pttbbs/mbbsd/io.c @@ -1,4 +1,4 @@ -/* $Id: io.c,v 1.28 2003/03/15 15:30:58 in2 Exp $ */ +/* $Id: io.c,v 1.29 2003/05/07 03:35:07 bbs Exp $ */ #include "bbs.h" #if defined(linux) @@ -139,7 +139,11 @@ dogetch() icurrchar = 0; } if (currutmp) { +#ifdef OUTTA_TIMER + now = SHM->GV2.e.now; +#else now = time(0); +#endif if (now - lastact < 3) currutmp->lastact = now; lastact = now; diff --git a/pttbbs/sample/pttbbs.conf b/pttbbs/sample/pttbbs.conf index 1903a6af..e222a34d 100644 --- a/pttbbs/sample/pttbbs.conf +++ b/pttbbs/sample/pttbbs.conf @@ -78,6 +78,10 @@ 仍可有好的上站率 */ //#define PRE_FORK 10 +/* 若定義, 則由 shmctl utmpsortd 將 time(NULL) 寫入 SHM->GV2.e.now, + 則不須每個 mbbsd都自己透過 time(NULL) 取得時間, 導致大量的 system call */ +//#define OUTTA_TIMER + /* 前進站畫面 */ #define INSCREEN \ "前進站畫面 (請至 pttbbs.conf 修改您的前進站畫面)" diff --git a/pttbbs/util/shmctl.c b/pttbbs/util/shmctl.c index 04f5b112..ac9cb15b 100644 --- a/pttbbs/util/shmctl.c +++ b/pttbbs/util/shmctl.c @@ -1,4 +1,4 @@ -/* $Id: shmctl.c,v 1.39 2003/04/10 18:05:45 in2 Exp $ */ +/* $Id: shmctl.c,v 1.40 2003/05/07 03:35:07 bbs Exp $ */ #include "bbs.h" #include @@ -275,6 +275,9 @@ int utmpsortd(int argc, char **argv) else{ while( 1 ){ int i; +#ifdef OUTTA_TIMER + SHM->GV2.e.now = time(NULL); +#endif for( i = 0 ; SHM->UTMPbusystate && i < 5 ; ++i ) usleep(300000); -- cgit v1.2.3