Date: Tue, 10 Feb 1998 21:32:46 -0800 (PST) Message-Id: <199802110532.VAA05864@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: chojnack AT quantum DOT de, djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: how to reset clock() Precedence: bulk At 08:52 2/10/1998 +0100, Tom Chojnacki wrote: >I want to measure time intervals in which some function executes itself. >I used clock() function which returns time which elapsed since first >call to clock(). But how can I reset the clock() to measure another time >interval and not time since the first call again. As far as I know, you can't. Your best bet is to save the value returned at the start of the interesting time and subtract the value returned at the end. i.e.: clock_t start_clock; start_clock = clock(); /* Code */ printf("Took %lu ticks\n", (unsigned long)clock() - start_clock); >Are there any alternative time measuring functions which I could use ?. Not that will do what you want. There is `gettimeofday', but it's more complicated to use. Also, under other operating systems, it will give different results. (`clock' measures CPU time used while `gettimeofday' measures real time, but on single-tasking DOS they're the same.) Nate Eldredge eldredge AT ap DOT net