[LC++]gettimeofday and C++

Mark Phillips mark at austrics.com.au
Fri Nov 9 17:10:23 UTC 2001


Hi,

I want to get access to the time from C++ (along with various other
system type things like detecting kill signals).  A little searching
and it seems the function "gettimeofday" is what I want.  In order that
I may use this function, I did:

#include <ctime>

but it couldn't find gettimeofday.  I changed it to:

#include <sys/time.h>

and it seems to work.  But this is not the preferred way of doing things
in C++.  It means things in sys/time.h are not in the std namespace --- not
a major problem, but it would be nice to do things the right way.

Any ideas on why #include <ctime> wouldn't work?

Thanks,

Mark.



More information about the tuxCPProgramming mailing list