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
commitd6ec2525926e9cbd3afc4b06ccd0300b05ddb301 (patch)
tree392fb96c328623e76467817faf231711220fcdbd
parent522c7c914b0c8e3400684de08907f9748e42c97b (diff)
downloadpttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.tar
pttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.tar.gz
pttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.tar.bz2
pttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.tar.lz
pttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.tar.xz
pttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.tar.zst
pttbbs-d6ec2525926e9cbd3afc4b06ccd0300b05ddb301.zip
fix util merging error
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1107 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/cache.c14
-rw-r--r--mbbsd/record.c8
-rw-r--r--mbbsd/var.c12
-rw-r--r--util/Makefile2
-rw-r--r--util/parsevar.pl4
5 files changed, 26 insertions, 14 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 7b26f8f2..945fed88 100644
--- a/mbbsd/cache.c
+++ b/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/mbbsd/record.c b/mbbsd/record.c
index 2bd06b16..e16b9404 100644
--- a/mbbsd/record.c
+++ b/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/mbbsd/var.c b/mbbsd/var.c
index 4ba3cf9e..7df518e5 100644
--- a/mbbsd/var.c
+++ b/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/util/Makefile b/util/Makefile
index 7d1073d7..b4788abd 100644
--- a/util/Makefile
+++ b/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/util/parsevar.pl b/util/parsevar.pl
index d532c786..fe2f2dc0 100644
--- a/util/parsevar.pl
+++ b/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;
}
}