summaryrefslogtreecommitdiffstats
path: root/mbbsd/cal.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/cal.c')
-rw-r--r--mbbsd/cal.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index a98dd001..afdc39ef 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -427,6 +427,29 @@ p_give(void)
return do_give_money(id, uid, atoi(money_buf));
}
+void
+resolve_over18(void)
+{
+ /* get local time */
+ struct tm ptime = *localtime4(&now);
+
+ over18 = 0;
+ /* check if over18 */
+ // 照實歲計算,沒生日的當作未滿 18
+ if (cuser.year < 1 || cuser.month < 1)
+ over18 = 0;
+ else if( (ptime.tm_year - cuser.year) > 18)
+ over18 = 1;
+ else if (ptime.tm_year - cuser.year < 18)
+ over18 = 0;
+ else if ((ptime.tm_mon+1) > cuser.month)
+ over18 = 1;
+ else if ((ptime.tm_mon+1) < cuser.month)
+ over18 = 0;
+ else if (ptime.tm_mday >= cuser.day )
+ over18 = 1;
+}
+
int
p_sysinfo(void)
{