From 6a428fb60d8ec6092d428b2e0f869a31f4890dc7 Mon Sep 17 00:00:00 2001 From: ptt Date: Mon, 13 May 2002 03:20:04 +0000 Subject: replace time(NULL) by now git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@163 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/record.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'mbbsd/record.c') diff --git a/mbbsd/record.c b/mbbsd/record.c index b572b7cf..2f82b372 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -1,4 +1,4 @@ -/* $Id: record.c,v 1.3 2002/04/15 20:00:22 in2 Exp $ */ +/* $Id: record.c,v 1.4 2002/05/13 03:20:04 ptt Exp $ */ #include #include #include @@ -17,7 +17,7 @@ #define BUFSIZE 512 extern char *str_reply; - +extern time_t now; static void PttLock(int fd, int size, int mode) { static struct flock lock_it; int ret; @@ -116,7 +116,7 @@ force_open (char *fname) int fd; time_t expire; - expire = time(NULL) - 3600; /* lock 存在超過一個小時就是有問題! */ + expire = now - 3600; /* lock 存在超過一個小時就是有問題! */ if (dasht (fname) < expire) return -1; unlink(fname); @@ -422,14 +422,13 @@ int apply_record(char *fpath, int (*fptr)(), int size) { /* mail / post 時,依據時間建立檔案,加上郵戳 */ int stampfile(char *fpath, fileheader_t *fh) { register char *ip = fpath; - time_t dtime; + time_t dtime=now; struct tm *ptime; int fp = 0; if(access(fpath, X_OK | R_OK | W_OK)) mkdir(fpath, 0755); - time(&dtime); while (*(++ip)); *ip++ = '/'; do { @@ -447,13 +446,12 @@ int stampfile(char *fpath, fileheader_t *fh) { void stampdir(char *fpath, fileheader_t *fh) { register char *ip = fpath; - time_t dtime; + time_t dtime=now; struct tm *ptime; if(access(fpath, X_OK | R_OK | W_OK)) mkdir(fpath, 0755); - time(&dtime); while(*(++ip)); *ip++ = '/'; do { @@ -467,13 +465,12 @@ void stampdir(char *fpath, fileheader_t *fh) { void stamplink(char *fpath, fileheader_t *fh) { register char *ip = fpath; - time_t dtime; + time_t dtime=now; struct tm *ptime; if(access(fpath, X_OK | R_OK | W_OK)) mkdir(fpath, 0755); - time(&dtime); while(*(++ip)); *ip++ = '/'; do { -- cgit v1.2.3