cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/07/06:11:12

From: "Michal Strelec" <strelec AT adam DOT osu DOT cz>
Newsgroups: comp.os.msdos.djgpp
Subject: CLOCKS_PER_SEC in DJGPP
Date: Fri, 6 Aug 1999 11:04:16 +0200
Organization: Czech Technical University
Lines: 29
Message-ID: <7oe8d8$unv$1@ns.felk.cvut.cz>
NNTP-Posting-Host: cl106161.osu.cz
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,
In my program I use function clock(), whitch returns number of timer ticks
from the begining of program.
But how many ticks timer do in a seconds in real?
I thought that 18.2, but in source code of communication package (pmcomm) I
found
****************************************
   Function: TIMERHandler
   Description:
     Invoked 19.5 times per second.
****************************************
And in DjGpp Timer.h I also found
#define CLOCKS_PER_SEC 91
In BC31 timer.h
#define CLOCKS_PER_SEC 18.2

So I'm a quit confused and I don't know how many times per sec timer runs.

Is it compiler dependece (clock function in djgpp vs. bc)?

That one problem, but here comes second:
On i386 the maximum allowed type of variable is ulong, isn't it?
But function clock returns long. So maximum number is 2147483647L. If I
transfer it to days (using 18.2 ticks per sec ) I get 1365 day = 3.7 year
(aproximately). But may program may run more then 3.7 year (in one run)
counter of this type may overflow.
Is any possibility how to englare this range?


- Raw text -


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