[uClibc] clock() for long-running process

Atsushi Nemoto anemo at mba.ocn.ne.jp
Sat May 8 13:20:37 UTC 2004


>>>>> On Sat, 8 May 2004 00:18:49 -0600, mjn3 at codepoet.org (Manuel Novoa III) said:

mjn3> Checked a new version of the time code into cvs, including a
mjn3> version of clock() which does wrapping.

Thank you.  New clock() now wraps on LONG_MAX (not ULONG_MAX).  I
think this is somewhat unuseful.

For example, this simple code will not work as expected if clock()
wrapped.

 clock_t start, elapsed;
 start = clock();
 /* do some (not so long) work */
 elapsed = clock() - start;

So I think we should not do bitwise-and with LONG_MAX.  And glibc's
implementation do not do the bitwise-and operation.  How do you think?

---
Atsushi Nemoto



More information about the uClibc mailing list