This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: clock() function problem.

On Wednesday 14 August 2002 09:16, DOBLEJ1 wrote:
> Hi:
>     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 
should explain?  
Beyond that, solutions are platform dependent, Off Topic even for, 
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.
Tim Prince

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]