From: DJ Delorie Newsgroups: comp.os.msdos.djgpp Subject: Re: how to reset clock() Date: 10 Feb 1998 20:39:17 -0500 Organization: DJ Delorie/DJGPP Support Lines: 15 Message-ID: References: <34E0B017 DOT 506A AT quantum DOT de> NNTP-Posting-Host: delorie.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Tom Chojnacki writes: > 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. You don't have to reset it. Just save the return value from before, and subtract it from the new one: before = clock(); do_something(); after = clock(); elapsed = after - before;