summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-06 21:25:08 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-06 21:25:08 +0800
commit2eb5731c5011ca46377f4301965c15cf7750b49a (patch)
tree54789bc040b953582c1fdea371266abb66521d11
parentcdc7c144df5bfa137d3f9dcdcb3fcbdd1561e579 (diff)
downloadpttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.tar
pttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.tar.gz
pttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.tar.bz2
pttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.tar.lz
pttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.tar.xz
pttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.tar.zst
pttbbs-2eb5731c5011ca46377f4301965c15cf7750b49a.zip
* adjust numlogindays calculation - should be rounded to each day.
git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4812 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/passwd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 548342c9..3bb8e352 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -442,6 +442,7 @@ int pwcuLoginSave ()
// was decided.
int regdays = 0, prev_regdays = 0;
int reftime = login_start_time;
+ time4_t baseref = 0;
PWCU_START();
// new host from 'fromhost'
@@ -451,12 +452,15 @@ int pwcuLoginSave ()
// this must be valid.
assert(login_start_time > 0);
+ // adjust base reference by rounding to beginning of each day (0:00am)
+ baseref = u.firstlogin - (u.firstlogin % DAY_SECONDS);
+
// invalid session?
if (reftime < u.lastlogin)
reftime = u.lastlogin;
- regdays = ( reftime - u.firstlogin) / DAY_SECONDS;
- prev_regdays = (u.lastlogin - u.firstlogin) / DAY_SECONDS;
+ regdays = ( reftime - baseref) / DAY_SECONDS;
+ prev_regdays = (u.lastlogin - baseref) / DAY_SECONDS;
// assert(regdays >= prev_regdays);
if (u.numlogindays > prev_regdays)