summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);