summaryrefslogtreecommitdiffstats
path: root/mbbsd/passwd.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-08 15:01:02 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-08 15:01:02 +0800
commit4a8c783de7fad2c94d0be94549904d7c542a7e74 (patch)
tree959543a2a5e27786ff38a792a4e1454e58c4c4ea /mbbsd/passwd.c
parentca5ee5b2867227c04827eb952685f8212715d1c7 (diff)
downloadpttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.tar
pttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.tar.gz
pttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.tar.bz2
pttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.tar.lz
pttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.tar.xz
pttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.tar.zst
pttbbs-4a8c783de7fad2c94d0be94549904d7c542a7e74.zip
* message refine
* adjust login time base (must consider timezone when rounding to midnight) git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4821 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/passwd.c')
-rw-r--r--mbbsd/passwd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index bfb64224..cfddca87 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -1,6 +1,7 @@
/* $Id$ */
#define PWCU_IMPL
#include "bbs.h"
+#include "time.h"
#ifdef _BBS_UTIL_C_
#error sorry, mbbsd/passwd.c does not support utility mode anymore. please use libcmbbs instead.
@@ -442,7 +443,9 @@ int pwcuLoginSave ()
// was decided.
int regdays = 0, prev_regdays = 0;
int reftime = login_start_time;
- time4_t baseref = 0;
+ time4_t baseref = 0;
+ struct tm baseref_tm = {0};
+
PWCU_START();
// new host from 'fromhost'
@@ -453,7 +456,12 @@ int pwcuLoginSave ()
assert(login_start_time > 0);
// adjust base reference by rounding to beginning of each day (0:00am)
- baseref = u.firstlogin - (u.firstlogin % DAY_SECONDS);
+ baseref = u.firstlogin;
+ if (localtime4_r(&baseref, &baseref_tm))
+ {
+ baseref_tm.tm_sec = baseref_tm.tm_min = baseref_tm.tm_hour = 0;
+ baseref = mktime(&baseref_tm);
+ }
// invalid session?
if (reftime < u.lastlogin)