From owner-cvs-src-old@FreeBSD.ORG Wed Feb 10 18:20:35 2010 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AB7210656D3 for ; Wed, 10 Feb 2010 18:20:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 1908D8FC0A for ; Wed, 10 Feb 2010 18:20:35 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o1AIKYRJ056147 for ; Wed, 10 Feb 2010 18:20:34 GMT (envelope-from delphij@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o1AIKY3s056146 for cvs-src-old@freebsd.org; Wed, 10 Feb 2010 18:20:34 GMT (envelope-from delphij@repoman.freebsd.org) Message-Id: <201002101820.o1AIKY3s056146@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to delphij@repoman.freebsd.org using -f From: Xin LI Date: Wed, 10 Feb 2010 18:20:20 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/games/grdc grdc.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Feb 2010 18:20:35 -0000 delphij 2010-02-10 18:20:20 UTC FreeBSD src repository Modified files: games/grdc grdc.c Log: SVN rev 203760 on 2010-02-10 18:20:20Z by delphij Improve time precision for grdc(6): Traditionally, grdc would obtain time through time(3) which in turn gets only the second part of clock (CLOCK_SECOND), and sleep for 1 second after each screen refresh. This approach would have two problems. First, we are not guaranteed to be waken up at the beginning of a whole second, which will typically exhibit as a "lag" on second number. Second, because we sleep for whole second, and the refresh process would take some time, the error would accumulate from time to time, making the lag variable. Make grdc(6) to use time(3) to get time only at the beginning, and sample time in CLOCK_REALTIME_FAST granularity after refreshing, and use the nanosecond part to caculate how much time we want to sleep. PR: bin/120813 MFC after: 1 month Revision Changes Path 1.13 +15 -2 src/games/grdc/grdc.c