www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/05/10/20:56:19

Message-ID: <35564C7E.2DED@cs.com>
Date: Sun, 10 May 1998 20:55:26 -0400
From: "John M. Aldrich" <fighteer AT cs DOT com>
Organization: Two pounds of chaos and a pinch of salt.
MIME-Version: 1.0
To: DJGPP Workers Mailing List <djgpp-workers AT delorie DOT com>
Subject: rawclock()

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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019