From 1747fb8d710780e60d9af73723da21a80197137b Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 15 Dec 2007 05:09:29 +0000 Subject: - unify processing clock variable 'now' - pmore: support time refresh git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3683 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/proto.h | 1 + mbbsd/io.c | 18 +++--------------- mbbsd/pmore.c | 9 +++++++-- mbbsd/stuff.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/proto.h b/include/proto.h index 9a956b96..502d04b6 100644 --- a/include/proto.h +++ b/include/proto.h @@ -639,6 +639,7 @@ int qsort_intcompar(const void *a, const void *b); #ifdef PLAY_ANGEL void pressanykey_or_callangel(void); #endif +void syncnow(void); /* syspost */ int post_msg(const char* bname, const char* title, const char *msg, const char* author); diff --git a/mbbsd/io.c b/mbbsd/io.c index 39b62836..1c3f9e7a 100644 --- a/mbbsd/io.c +++ b/mbbsd/io.c @@ -169,20 +169,12 @@ dogetch(void) } if (len == 0){ -#ifdef OUTTA_TIMER - now = SHM->GV2.e.now; -#else - now = time(0); -#endif + syncnow(); return I_TIMEOUT; } if (i_newfd && FD_ISSET(i_newfd, &readfds)){ -#ifdef OUTTA_TIMER - now = SHM->GV2.e.now; -#else - now = time(0); -#endif + syncnow(); return I_OTHERDATA; } } @@ -209,11 +201,7 @@ dogetch(void) } if (currutmp) { -#ifdef OUTTA_TIMER - now = SHM->GV2.e.now; -#else - now = time(0); -#endif + syncnow(); /* 3 秒內超過兩 byte 才算 active, anti-antiidle. * 不過方向鍵等組合鍵不止 1 byte */ if (now - lastact < 3) diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index abca918f..eac18ac1 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -18,7 +18,7 @@ * You must keep these copyright infomration. * * MAJOR IMPROVEMENTS: - * - Clean source code, and more readble to mortal + * - Clean source code, and more readable for mortal * - Correct navigation * - Excellent search ability (for correctness and user behavior) * - Less memory consumption (mmap is not considered anyway) @@ -42,9 +42,9 @@ * - Playback Control (pause, stop, skip) [done] * - Interactive Movie (Hyper-text) [done] * - Preference System (like board-conf) [done] + * - Traditional Movie Compatible Mode * - * - Support Anti-anti-idle (ex, PCMan sends up-down) - * - Traditional Movie Compatible Mode * - Better help system [pending] * - Virtual Contatenate [pending] * - Drop ANSI between DBCS words if outputing UTF8 [drop] (or if user request) @@ -2707,6 +2707,11 @@ pmore_wait_key(struct timeval *ptv, int dorefresh) // now, maybe something for read (sel > 0) // or time out (sel == 0) // or weird error (sel < 0) + + // sync clock(now) if timeout. + if (sel == 0) + syncnow(); + return (sel == 0) ? 0 : 1; } diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index abe65680..e7cbaf34 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -238,6 +238,17 @@ gettime(int line, time4_t dt, const char*head) } while ((endtime.tm_hour = atoi(yn)) < 0 || endtime.tm_hour > 23); return mktime(&endtime); } + +// synchronize 'now' +void syncnow(void) +{ +#ifdef OUTTA_TIMER + now = SHM->GV2.e.now; +#else + now = time(0); +#endif +} + #endif -- cgit v1.2.3