diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2012-02-09 23:34:51 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2012-02-09 23:34:51 +0800 |
commit | 3ecbd4823ea79347196c68de7b69dd5dd5f50f89 (patch) | |
tree | 20688b446d0d2b511798d229d1fdcee52b26060b | |
parent | 302a09ac09ba615bb76ea19666986b040e0543a4 (diff) | |
download | pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.tar pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.tar.gz pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.tar.bz2 pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.tar.lz pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.tar.xz pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.tar.zst pttbbs-3ecbd4823ea79347196c68de7b69dd5dd5f50f89.zip |
Fix divide-by-zero if the site population is small.
Thanks to Moti@ptt2.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5561 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/util/account.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pttbbs/util/account.c b/pttbbs/util/account.c index aad84aae..822969b8 100644 --- a/pttbbs/util/account.c +++ b/pttbbs/util/account.c @@ -154,6 +154,9 @@ output_today(struct tm *ptime, int act[27], int peak_hour_login, int day_login) int avg_len = ((day_login - peak_hour_login) / 23) + 1; int bar_unit = avg_len / (bar_max_width / 2 / 2); + if (bar_unit < 1) + bar_unit = 1; + printf("peak: %d, day_login: %d\n", peak_hour_login, day_login); printf("avg_len=%d, bar_unit=%d\n", avg_len, bar_unit); |