time.h function clock() only returning 0

Brian Bober netdemonz at yahoo.com
Thu Apr 8 01:40:29 UTC 2004


I was testing whether clock skew between gettimeofday and between clock() still
occurred, and I noticed now that clock() returns 0 only.

Linux netdragon1 2.6.4-1.305 #1 Fri Apr 2 13:46:07 EST 2004 i686 i686 i386
GNU/Linux
g++ (GCC) 3.3.3 20040311 (Red Hat Linux 3.3.3-3)

Sample code output:

[boberb at netdragon1 gettimeofday]$ ./clock
0
0

Sample code:

/* clocktest.cpp */
#include <time.h>
#include <iostream>

int main(void)
{
    std::cout<<clock()<<std::endl;
    sleep(1);
    std::cout<<clock()<<std::endl;
    return 0;
}





More information about the fedora-test-list mailing list