From owner-cvs-src-old@FreeBSD.ORG Fri Mar 12 00:51:24 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 3031910656E1 for ; Fri, 12 Mar 2010 00:51:24 +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 09ED08FC0A for ; Fri, 12 Mar 2010 00:51:22 +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 o2C0pLw0056344 for ; Fri, 12 Mar 2010 00:51:21 GMT (envelope-from delphij@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o2C0pLB3056343 for cvs-src-old@freebsd.org; Fri, 12 Mar 2010 00:51:21 GMT (envelope-from delphij@repoman.freebsd.org) Message-Id: <201003120051.o2C0pLB3056343@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to delphij@repoman.freebsd.org using -f From: Xin LI Date: Fri, 12 Mar 2010 00:51:13 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: RELENG_8 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: Fri, 12 Mar 2010 00:51:24 -0000 delphij 2010-03-12 00:51:13 UTC FreeBSD src repository Modified files: (Branch: RELENG_8) games/grdc grdc.c Log: SVN rev 205056 on 2010-03-12 00:51:13Z by delphij MFC r203760: 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 Revision Changes Path 1.12.32.2 +15 -2 src/games/grdc/grdc.c