www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/13/02:57:25

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2609
Path: news-dnh.mv.net!mv!news.sprintlink.net!news.clark.net!rahul.net!a2i!bug.rahul.net!a2i!olivea!hookup!news.mathworks.com!tank.news.pipex.net!pipex!dish.news.pipex.net!pipex!mantis!mantis!not-for-mail
From: olly AT mantis DOT co DOT uk (Olly Betts)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: clock() unit ?
Date: 12 Oct 1995 18:21:13 +0100
Organization: techn-ol-ogy
Lines: 33
References: <45iniu$6c5 AT news DOT cea DOT fr>
Nntp-Posting-Host: sunforest.mantis.co.uk
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <45iniu$6c5 AT news DOT cea DOT fr>,
Eric NICOLAS <nicolas AT dsys DOT ceng DOT cea DOT fr> wrote:
>ANSI C tell that there should be a CLK_TCK constant which says that, but I
>found
>somewhere in djgpp .H a #define CLK_TCK 100, and when trying that it is
>obvious
>that this is wrong.
>
>In fact, it seems that there are about 1 million clock() units per seconds.
>But
>what is the real value ?

In DJGPP v1.12m4, time.h says: #define CLOCKS_PER_SEC 1000000
and limits.h says: #define CLK_TCK 100

I *think* that CLOCKS_PER_SEC is an old alternative name for CLK_TCK, so they
should be the same if both are defined.  I may be wrong though.

Anyway, coupled with what you say, it looks like the real value is exactly
1000000, and that the CLK_TCK in limits.h is bogus.

In DJGPP v2-beta3, time.h says: #definde CLOCKS_PER_SEC 91
and also: #define CLK_TCK CLOCKS_PER_SEC

So they are the same there.  A comment says:

/* 65536(tics/hour) / 3600(sec/hour) * 5(scale) = 91.02
   The 5 is to make it a whole number (18.2*5=91) so that
   floating point ops aren't required to use it. */

Olly
-- 
cool wet grass  cool wet grass  cool wet grass  cool wet grass  cool wet grass

- Raw text -


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