delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/10/16:54:58

To: djgpp AT delorie DOT com
Date: Tue, 10 Jun 1997 13:46:52 -0700
Subject: rawclock() and other time.h functions
Message-ID: <19970610.134653.8846.0.bshadwick@juno.com>
From: bshadwick AT juno DOT com (Ben N Shadwick)

I was going to use rawclock() to seed the random number generator in a
DJGPP/Allegro program I'm writing, as the info file, libc.inf, said that
rawclock() returns the number of clock ticks since midnight (I was hoping
that it would be similar to saying RANDOMIZE TIMER in BASIC <hehe>).
Here, I'll quote it for you:

"rawclock
========
Syntax
------
     #include <time.h>
     unsigned long rawclock(void);

Description
-----------
Returns the number of clock tics (18.2 per second) since midnight.

Return Value
------------
The number of tics."

Well, the problem is, it doesn't return the number of clock ticks since
midnight, but rather the number of somethings (clock ticks I suppose)
since the first time it was called! I know that some of the time.h
functions are specifically described as returning the number of something
since the first call, but I also know that (as you can see) rawclock()
isn't supposed to work that way (according to the reference manual,
anyways).

Is there something I didn't do? Do I have to call some function or set
some flag to set it up? I know it's not caused by anything other than
DJGPP itself, as this small program I just made yields the same results:

#include <stdio.h>
#include <time.h>
#include <conio.h>

int main(int argc, char *argv[]) /* :P */
{
   while(!kbhit())
      printf("%lu\n", rawclock());
}

Thanx for your help, everybody!

=====
Ben Shadwick, Sysop, Mars Base BBS, (360)882-0773, Vancouver, WA, USA
Unofficial member, TheGods/DemiUrg Software,
http://www.swiftsite.com/thegods
email: bshadwick AT juno DOT com (please reply to newsgroup posts via email too)
DJGPP or bust! Going my way?

- Raw text -


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