From a425ca098d478cfe95b135ab66f454d86fea3c28 Mon Sep 17 00:00:00 2001 From: hongling0 Date: Tue, 18 Feb 2014 19:24:59 +0800 Subject: [PATCH] timerBUG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit linux系统在特定的时间点,_gettime()会溢出,timer将不会触发timeout事件 --- skynet-src/skynet_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skynet-src/skynet_timer.c b/skynet-src/skynet_timer.c index 0a593cdd..96084ec1 100644 --- a/skynet-src/skynet_timer.c +++ b/skynet-src/skynet_timer.c @@ -220,8 +220,8 @@ _gettime(void) { void skynet_updatetime(void) { uint32_t ct = _gettime(); - if (ct > TI->current) { - int diff = ct-TI->current; + if (ct != TI->current) { + int diff = ct>=TI->current?ct-TI->current:(0xffffff+1)*100-TI->current+ct; TI->current = ct; int i; for (i=0;i