lkml.org 
[lkml]   [1999]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.039 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site