This is the mail archive of the
mailing list for the GCC project.
Re: clock() function problem.
- From: Tim Prince <tprince at computer dot org>
- To: DOBLEJ1 <DOBLEJ at teleline dot es>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Wed, 14 Aug 2002 22:31:02 -0700
- Subject: Re: clock() function problem.
- References: <3D5A827B.8D8E92F4@teleline.es>
- Reply-to: tprince at computer dot org
On Wednesday 14 August 2002 09:16, DOBLEJ1 wrote:
> The clock() function call does what we want, but with one serious
> side effect: It rolls over after 2147 seconds. This is less
> than the CPU times we expect to measure. It also does not roll over to
> zero, but starts _descending_ after it rolls
> over. Does anyone know how to reset clock() so that it starts from zero
> again, or better yet, a simple, clean way of measuring
> large amounts of process CPU time?
> Thanks in advanced.
gcc doesn't incorporate the standard library functions; these come from
elsewhere; e.g. part of your OS.
Did you read about your clock() in 'man clock', 'info clock' or the like, or
in a standard C textbook? Are you using clock_t typed variables, as they
Beyond that, solutions are platform dependent, Off Topic even for gcc.help,
where some of the above might be on topic. Quality of Implementation in
terms of maximizing roll over interval is unusual for this function, but I'm
already well beyond the scope of gcc.