delorie.com/archives/browse.cgi | search |
Message-ID: | <3714DC8F.726858F2@vortex.ufrgs.br> |
Date: | Wed, 14 Apr 1999 15:21:03 -0300 |
From: | "Luciano R. M. Silva" <lrms AT vortex DOT ufrgs DOT br> |
X-Mailer: | Mozilla 4.51 [en] (Win95; I) |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Newbie question. Please help |
References: | <01be8371$2d0814c0$LocalHost AT aguia> |
Lines: | 27 |
NNTP-Posting-Host: | irc.ez-poa.com.br |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hi, I think that should help: Simply use clock(), it also uses the BIOS clock tick or use uclock() that also (I guess) read the timer counter from the 8254 to get a better resolution. To get the time in seconds just subtratec two times and divide by CLOCKS_PER_SEC (or UCLOCKS_PER_SEC in case of uclock()). #include <time.h> . . . clock_t t1, t2; float tseconds; . . . t1 = clock(); . . . t2 = clock(); tseconds = (t2 - t1) / (float)CLOCKS_PER_SEC; Don't forget that BIOS timer tick have a resolution of 55ms (18.2Hz).
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |