summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-08-18 19:48:17 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-08-18 19:48:17 +0800
commitf4024411c06cd704e9b30ac9cfe5bdba07e21733 (patch)
tree9e739724ee6b79bf997d5374a1b992befc868f55
parente7586158938262d19905030d3e0be61bcdba5113 (diff)
downloadpttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.tar
pttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.tar.gz
pttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.tar.bz2
pttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.tar.lz
pttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.tar.xz
pttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.tar.zst
pttbbs-f4024411c06cd704e9b30ac9cfe5bdba07e21733.zip
fix util merging error
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1107 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/mbbsd/cache.c14
-rw-r--r--pttbbs/mbbsd/record.c8
-rw-r--r--pttbbs/mbbsd/var.c12
-rw-r--r--pttbbs/util/Makefile2
-rw-r--r--pttbbs/util/parsevar.pl4
5 files changed, 26 insertions, 14 deletions
diff --git a/pttbbs/mbbsd/cache.c b/pttbbs/mbbsd/cache.c
index 7b26f8f2..945fed88 100644
--- a/pttbbs/mbbsd/cache.c
+++ b/pttbbs/mbbsd/cache.c
@@ -492,7 +492,7 @@ setutmpmode(unsigned int mode)
if (HAS_PERM(PERM_LOGUSER)) {
char msg[200];
snprintf(msg, sizeof(msg), "%s setutmpmode to %s(%d) at %s",
- cuser.userid, modestring(currutmp, 0), mode, Cdate(&now));
+ cuser.userid, modestring(currutmp, 0), mode, Cdate(&COMMON_TIME));
log_user(msg);
}
}
@@ -518,8 +518,8 @@ load_fileheader_cache(int bid, char *direct)
{
int num = getbtotal(bid);
int n = num - DIRCACHESIZE + 1;
- if (SHM->Bbusystate != 1 && now - SHM->busystate_b[bid - 1] >= 10) {
- SHM->busystate_b[bid - 1] = now;
+ if (SHM->Bbusystate != 1 && COMMON_TIME - SHM->busystate_b[bid - 1] >= 10) {
+ SHM->busystate_b[bid - 1] = COMMON_TIME;
get_records(direct, SHM->dircache[bid - 1],
sizeof(fileheader_t), n < 1 ? 1 : n, DIRCACHESIZE);
SHM->busystate_b[bid - 1] = 0;
@@ -620,7 +620,7 @@ void resolve_boards(void)
void touch_boards(void)
{
- SHM->Btouchtime = now;
+ SHM->Btouchtime = COMMON_TIME;
numboards = -1;
resolve_boards();
}
@@ -639,10 +639,10 @@ reset_board(int bid) /* XXXbid: from 1 */
if (--bid < 0)
return;
- if (SHM->Bbusystate || now - SHM->busystate_b[bid] < 10) {
+ if (SHM->Bbusystate || COMMON_TIME - SHM->busystate_b[bid] < 10) {
safe_sleep(1);
} else {
- SHM->busystate_b[bid] = now;
+ SHM->busystate_b[bid] = COMMON_TIME;
nuser = bcache[bid].nuser;
bhdr = bcache;
@@ -998,7 +998,7 @@ hbflreload(int bid)
}
fclose(fp);
}
- hbfl[0] = now;
+ hbfl[0] = COMMON_TIME;
memcpy(SHM->hbfl[bid], hbfl, sizeof(hbfl));
}
diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c
index 2bd06b16..e16b9404 100644
--- a/pttbbs/mbbsd/record.c
+++ b/pttbbs/mbbsd/record.c
@@ -1,4 +1,4 @@
-/* $Id: record.c,v 1.14 2003/06/28 08:47:45 kcwu Exp $ */
+/* $Id$ */
#include "bbs.h"
#undef HAVE_MMAP
@@ -467,7 +467,7 @@ int
stampfile(char *fpath, fileheader_t * fh)
{
register char *ip = fpath;
- time_t dtime = now;
+ time_t dtime = COMMON_TIME;
struct tm *ptime;
int fp = 0;
@@ -494,7 +494,7 @@ void
stampdir(char *fpath, fileheader_t * fh)
{
register char *ip = fpath;
- time_t dtime = now;
+ time_t dtime = COMMON_TIME;
struct tm *ptime;
if (access(fpath, X_OK | R_OK | W_OK))
@@ -516,7 +516,7 @@ void
stamplink(char *fpath, fileheader_t * fh)
{
register char *ip = fpath;
- time_t dtime = now;
+ time_t dtime = COMMON_TIME;
struct tm *ptime;
if (access(fpath, X_OK | R_OK | W_OK))
diff --git a/pttbbs/mbbsd/var.c b/pttbbs/mbbsd/var.c
index 4ba3cf9e..7df518e5 100644
--- a/pttbbs/mbbsd/var.c
+++ b/pttbbs/mbbsd/var.c
@@ -1,4 +1,4 @@
-/* $Id: var.c,v 1.21 2003/07/20 00:55:34 in2 Exp $ */
+/* $Id$ */
#define INCLUDE_VAR_H
#include "bbs.h"
@@ -621,3 +621,13 @@ char *friend_file[8] = {
FN_WATER,
FN_VISABLE
};
+
+#ifdef PTTBBS_UTIL
+ #ifdef OUTTA_TIMER
+ #define COMMON_TIME (SHM->GV2.e.now)
+ #else
+ #define COMMON_TIME (time(0))
+ #endif
+#else
+ #define COMMON_TIME (now)
+#endif
diff --git a/pttbbs/util/Makefile b/pttbbs/util/Makefile
index 7d1073d7..b4788abd 100644
--- a/pttbbs/util/Makefile
+++ b/pttbbs/util/Makefile
@@ -2,6 +2,8 @@
.include "../pttbbs.mk"
+CFLAGS+= -DPTTBBS_UTIL
+
UTIL_OBJS= \
util_cache.o util_record.o util_passwd.o util_var.o \
util_stuff.o util_osdep.o util_args.o
diff --git a/pttbbs/util/parsevar.pl b/pttbbs/util/parsevar.pl
index d532c786..fe2f2dc0 100644
--- a/pttbbs/util/parsevar.pl
+++ b/pttbbs/util/parsevar.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: parsevar.pl,v 1.2 2003/06/20 22:06:30 in2 Exp $
+# $Id$
print << '.';
/*
* This header file is auto-generated from pttbbs/mbbsd/var.c .
@@ -16,7 +16,7 @@ while( <> ){
$_ = substr($_, 0, index($_, '=') - 1) if( index($_, '=') != -1 );
$_ .= ';' if( index($_, ';') == -1 );
print "extern $_\n";
- } elsif( /^\#/ && !/include/ ){
+ } elsif( /^\s*\#/ && !/include/ ){
print;
}
}