summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--mbbsd/passwd.c12
-rw-r--r--mbbsd/user.c3
2 files changed, 12 insertions, 3 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)
diff --git a/mbbsd/user.c b/mbbsd/user.c
index b6bc04b0..edfbc17f 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -173,7 +173,8 @@ user_display(const userec_t * u, int adminmode)
prints("\t\t認證資料: %s\n", u->justify);
}
- prints("\t\t使用記錄: " STR_LOGINDAYS " %d " STR_LOGINDAYS_QTY
+ // XXX enable STR_LOGINDAYS_QTY after removed old_numlogins.
+ prints("\t\t使用記錄: " STR_LOGINDAYS " %d " // STR_LOGINDAYS_QTY
,u->numlogindays);
if (u->old_numlogins)
prints("(轉換新制前結算:%d)", u->old_numlogins);