summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h5
-rw-r--r--mbbsd/io.c6
-rw-r--r--sample/pttbbs.conf4
-rw-r--r--util/shmctl.c5
4 files changed, 17 insertions, 3 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 0d60a7a5..cb60f97d 100644
--- a/include/pttstruct.h
+++ b/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/mbbsd/io.c b/mbbsd/io.c
index 3e8f79a7..3b15bbe7 100644
--- a/mbbsd/io.c
+++ b/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/sample/pttbbs.conf b/sample/pttbbs.conf
index 1903a6af..e222a34d 100644
--- a/sample/pttbbs.conf
+++ b/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/util/shmctl.c b/util/shmctl.c
index 04f5b112..ac9cb15b 100644
--- a/util/shmctl.c
+++ b/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 <sys/wait.h>
@@ -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);