www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/08/08:48:47

From: kunst AT prl DOT philips DOT nl
Subject: Re: clock() problems
To: dj AT stealth DOT ctron DOT com (DJ Delorie)
Date: Tue, 8 Nov 1994 10:37:13 +0100 (MET)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP users list)

> The reason why we can use clock() at up to 1.19 MHz is because the
> hardware keeps track of it for us.  All we have to do is *calculate*
> the return value of clock() when it's called.  We don't actually have
> to get interrupted on each tic.

For those out there who are talking about nanosecond resolution 
it is worth remembering that the DJGPP implementation of clock()
isn't exactly what it is supposed to be, i.e. a measure of 
*consumed CPU time by the program*.
Running the program inside a Windows DOS box makes things even worse.


------------------------- K&R, 2nd, p.255 ----------------------------------
clock_t clock(void)
  clock returns the processor time used by the program since the
  beginning of execution, or -1 if unavailable.


Pieter Kunst (kunst AT prl DOT philips DOT nl)

- Raw text -


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