www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/29/19:22:07

Xref: news2.mv.net comp.os.msdos.djgpp:8038
From: elric AT wheel DOT dcn DOT davis DOT ca DOT us (Jeffrey Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: HRTIMER
Date: 29 Aug 1996 17:09:52 GMT
Organization: Davis Community Network - Davis, California, USA
Lines: 36
Message-ID: <504it0$btk@mark.ucdavis.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960822085948 DOT 2237P-100000 AT is>
NNTP-Posting-Host: wheel.dcn.davis.ca.us
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:
: 
: On 21 Aug 1996, Sam Phillips wrote:
: 
: > I've been trying to time some code with HRTIMER and everytime it runs the
: > program it returns with a 0 for how long the operation took.
: 
: What is HRTIMER?

This is the code I use for timing programs.  It works fine for me.  The 
resolution is 1/18 of a second.

 -- 
============================================
Without my guitar, I am a poet without arms.
                        - Michael Bloomfield
============================================


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


int main(int argc, char *argv[])
{
	int status;
	clock_t start = clock();

	status = spawnvp(P_WAIT, argv[1], argv + 1);

	fprintf(stderr, "elapsed time: %.2f seconds\n",
				(float)(clock() - start) / CLK_TCK);
				
	return status;
}

- Raw text -


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