2.0.34: clock() returns -1 after 248.5 days uptime

Ville Herva (vherva@niksula.hut.fi)
Wed, 17 Feb 1999 17:46:12 +0200


I don't know if this has been fixed yet. I'm sorry for disturbing if
that's the case.

Anyway: the following snipped pretty much tells it all:

vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>uname -a
Linux turing 2.0.34 #1 Sun May 17 18:45:16 EEST 1998 i686 unknown
vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>uptime
5:43pm up 275 days, 22:42, 2 users, load average: 0.00, 0.00, 0.00
vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>rpm -q glibc
glibc-2.0.7-7
vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>cat ../../c.c
#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;
}

vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>gcc ../../c.c -o ../../c
vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>../../c
timer: -1
clock(): -1
CLK_TCK: 100
CLOCKS_PER_SEC: 1000000
0.00 3.2f secs.

A heuristic guess:

vherva@turing:/home/vherva/zsh-3.1.5-pws-8/Src>perl -e '$CLK_TCK = 100;
print 2**31 / $CLK_TCK / 60 / 60 / 24, "\n days"'
248.551348148148 days

248 days it quite accurately the uptime I begun having strange problems
(with zsh that begun not to echo chars I typed.) I'm uncertain whether
these problems are related, but the uptime seems quite suspicious.

Other functions may have this problem too, I haven't tried them all.

As always, I can provide additional info upon request.

-- v --

v@iki.fi

-
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/