From: Alan Newsgroups: comp.os.msdos.djgpp Subject: Re: CLOCKS_PER_SEC in DJGPP Date: Fri, 06 Aug 1999 06:34:40 -0400 Organization: Interlog Internet Services Lines: 32 Message-ID: <37AABA40.74837B07@interlog.com> References: <7oe8d8$unv$1 AT ns DOT felk DOT cvut DOT cz> NNTP-Posting-Host: 209-20-0-90.dialin.interlog.com NNTP-Posting-Time: 6 Aug 1999 10:34:12 GMT Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Go with 18.2/sec. When you ulong overflows, inc another ulong. Michal Strelec wrote: > > 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?