Messages in this thread | | | Date | Thu, 18 Feb 99 07:41 MET | From | (Hans-Joachim Baader) | Subject | Re: 2.0.34: clock() returns -1 after 248.5 days uptime |
| |
In article <19990217174612.A14497@niksula.cs.hut.fi> you write: >#include <time.h> >#include <stdio.h> > >int main(int argc, char* argv[]) >{ > int i; > int timer = clock(); > for (i = 1000000; i; i--); > printf("timer: %i\nclock(): %i\nCLK_TCK: %i\n" > "CLOCKS_PER_SEC: %i\n%3.2f 3.2f secs.\n", > timer, clock(), CLK_TCK, CLOCKS_PER_SEC, > (float)(clock() - timer) / (float)CLK_TCK / 10000.0, > (float)(clock() - timer) / (float)CLOCKS_PER_SEC); > > return 1; >}
Your program is incorrect. clock() returns clock_t, not int. clock_t is long in glibc 2.1, so on a 32 bit architecture this would help nothing...
Certainly a result of -1 is less than useful. But perhaps it conforms to some standard ;-| Since clock() is a libc function you should ask the libc maintainers about it.
hjb -- "Every use of Linux is a proper use of Linux." -- John "Maddog" Hall, Keynote at the Linux Kongress in Cologne
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |