-
June 26th, 2011, 07:23 PM
#1
Getting problem with using struct timeval
Hi all,
I am us ing MS visual studio 2010 for compiling the C source code. While compiling I am getting the problem with header file time.h.The problem is , I get the error
"undefined reference to the suseconds_t" and some other syntactical error on the structure.
But the the structure timeval is defined as follows.
#ifndef _WINSOCK_H
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
I am passing this structure in the function named getTimeofDay(struct timeval *tv, struct timezone *tz) to get the elapse time. This function is defined
int getTimeof Day(struct timeval *tv, struct timezone *tz){
DWORD milliseconds;
milliseconds = timeGetTime();
tv->tv_sec =milliseconds/100;
tv->tv_usec =(milliseconds%1000)*1000;
return 0;
}
Once i change the DWORD with int long and time_t and suseconds_t with long , it compiles. Could you please let me know how can I get rid of this problem.
My operating system is Windows XP.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|