I have an application that I port to Microsoft Visual Studio 2008 that works fine and works on Linux.
I'm having problems with time programs, my Linux code is as follows:
#include <sys/types.h> #include <sys/time.h> typedef long long Usec; inline Usec timevalToUsec(const timeval &tv) { return (((Usec) tv.tv_sec) * 1000000) + ((Usec) tv.tv_usec); }
But the compiler does not work in the sys/time.h
header file:
fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
If I change the include to just time.h
, I get another error with an undefined timeval:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
This is because timeval
is undefined.
Includes time.h
instead of sys/time.h
correctly, and if so, where can I get the definition of struct timeval
in Microsoft Visual Studio 2008?
source share