Message-ID: <35564C7E.2DED@cs.com> Date: Sun, 10 May 1998 20:55:26 -0400 From: "John M. Aldrich" Organization: Two pounds of chaos and a pinch of salt. MIME-Version: 1.0 To: DJGPP Workers Mailing List Subject: rawclock() Content-Type: multipart/mixed; boundary="------------311E3E693CDE" Precedence: bulk This is a multi-part message in MIME format. --------------311E3E693CDE Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I was unable to find any reference to this in the djgpp-workers archives or the bug tracker. If this has been discussed before, I apologize. There's a bug in either the libc docs for rawclock() or the function itself. According to the docs: ---snip--- unsigned long rawclock(void); Description ----------- Returns the number of clock tics (18.2 per second) since midnight. ---snip--- However, according to the source, rawclock() actually returns the number of tics since the first call to itself in the program. This seems to exactly duplicate the functionality of clock(), so I assume that the function itself is in error. A patch is attached. -- --------------------------------------------------------------------- | John M. Aldrich | A singer in a smoky room / Smell of | | aka Fighteer I | wine and cheap perfume / For a smile | | mailto:fighteer AT cs DOT com | they can share the night / It goes | | http://www.cs.com/fighteer | on and on and on... | --------------------------------------------------------------------- --------------311E3E693CDE Content-Type: text/plain; charset=us-ascii; name="rawclock.dif" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rawclock.dif" *** src/libc/compat/time/rawclock.c~ Sun Jun 4 03:32:58 1995 --- src/libc/compat/time/rawclock.c Sun May 10 20:53:06 1998 *************** *** 6,15 **** unsigned long rawclock(void) { ! static unsigned long base = 0; ! unsigned long rv; ! rv = _farpeekl(_dos_ds, 0x46c); ! if (base == 0) ! base = rv; ! return rv - base; } --- 6,10 ---- unsigned long rawclock(void) { ! return _farpeekl(_dos_ds, 0x46c); } --------------311E3E693CDE--