summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:03:03 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:03:03 +0800
commitd4ca75df642237f81a2958fb395df41083e5c173 (patch)
treedfb3615f6a08517ee8b547d8cab641b9d4bd234c
parenta955ee6b77652aa57f0009f9878aa88d1755ce8d (diff)
downloadpttbbs-d4ca75df642237f81a2958fb395df41083e5c173.tar
pttbbs-d4ca75df642237f81a2958fb395df41083e5c173.tar.gz
pttbbs-d4ca75df642237f81a2958fb395df41083e5c173.tar.bz2
pttbbs-d4ca75df642237f81a2958fb395df41083e5c173.tar.lz
pttbbs-d4ca75df642237f81a2958fb395df41083e5c173.tar.xz
pttbbs-d4ca75df642237f81a2958fb395df41083e5c173.tar.zst
pttbbs-d4ca75df642237f81a2958fb395df41083e5c173.zip
statistic for user's first login today
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2653 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/statistic.h3
-rw-r--r--mbbsd/mbbsd.c12
-rw-r--r--util/shmctl.c2
3 files changed, 14 insertions, 3 deletions
diff --git a/include/statistic.h b/include/statistic.h
index e2e6b61b..81ad937b 100644
--- a/include/statistic.h
+++ b/include/statistic.h
@@ -30,6 +30,9 @@ enum { // XXX description in shmctl.c
STAT_DOPOST,
STAT_READPOST,
STAT_RECOMMEND,
+ STAT_TODAYLOGIN_MIN,
+ STAT_TODAYLOGIN_MAX,
+ /* insert here. don't forget update shmctl.c */
STAT_NUM,
STAT_MAX=512
};
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 9d8bdc1e..78a4c24d 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -906,7 +906,7 @@ inline static void foreign_warning(void){
static void
user_login(void)
{
- struct tm ptime;
+ struct tm ptime, lasttime;
int nowusers, ifbirth = 0, i;
/* get local time */
@@ -961,6 +961,7 @@ user_login(void)
setup_utmp(LOGIN);
currmode = MODE_STARTED;
enter_uflag = cuser.uflag;
+ lasttime = *localtime4(&cuser.lastlogin);
if ((nowusers = SHM->UTMPnumber) > SHM->max_user) {
SHM->max_user = nowusers;
@@ -982,7 +983,7 @@ user_login(void)
welcome_msg();
if( ifbirth ){
- birthday_make_a_wish(&ptime, localtime4(&(cuser.lastlogin)));
+ birthday_make_a_wish(&ptime, &lasttime);
if( getans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' )
currutmp->birth = 1;
}
@@ -998,9 +999,14 @@ user_login(void)
pressanykey();
check_mailbox_quota();
}
+ if(ptime.tm_yday!=lasttime.tm_yday)
+ STATINC(STAT_TODAYLOGIN_MAX);
- if (!PERM_HIDE(currutmp))
+ if (!PERM_HIDE(currutmp)) {
+ if(ptime.tm_yday!=lasttime.tm_yday)
+ STATINC(STAT_TODAYLOGIN_MIN);
cuser.lastlogin = login_start_time;
+ }
#if FOREIGN_REG_DAY > 0
foreign_warning();
diff --git a/util/shmctl.c b/util/shmctl.c
index 411562d2..26a7e67b 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -928,6 +928,8 @@ int showstat(int argc, char *argv[])
"STAT_DOPOST",
"STAT_READPOST",
"STAT_RECOMMEND",
+ "STAT_TODAYLOGIN_MIN",
+ "STAT_TODAYLOGIN_MAX",
};
if(argv[1] && strcmp(argv[1],"-c")==0)