www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/06/14:53:11

From: "Michal Strelec" <strelec AT adam DOT osu DOT cz>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: CLOCKS_PER_SEC in DJGPP
Date: Fri, 6 Aug 1999 12:05:50 +0200
Organization: Czech Technical University
Lines: 54
Message-ID: <7oec0m$140b$1@ns.felk.cvut.cz>
References: <7oe8d8$unv$1 AT ns DOT felk DOT cvut DOT 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,
it's me again
>but in source code of communication package (pmcomm) I
>found
>****************************************
>   Function: TIMERHandler
>   Description:
>     Invoked 19.5 times per second.
>****************************************

This in timer interrupt function (so I guess)  timer interrupt is generate
ALWAYS 19.5 times per sec, am I right?


>And in DjGpp Timer.h I also found
>#define CLOCKS_PER_SEC 91

I looked to source code of function clock and found on the last line that
output is multiplicated by 5. To ensure no FP calculations. BUT this rapidly
reduce time interval which can be managed by this functions.


>In BC31 timer.h
>#define CLOCKS_PER_SEC 18.2


stays clear.


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


I'm almost ok.

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


Sure it is. But only in meaning of capable time interval.

>That one problem, but here comes second:

This problem stays.

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


Mike


- Raw text -


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