The timeval structure is used to specify a time interval. It is associated with the Berkeley Software Distribution (BSD) Time.h header file.
typedef struct timeval {
long tv_sec;
long tv_usec;
} TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
tv_sec
Time interval, in seconds.
tv_usec
Time interval, in microseconds. This value is used in combination with the tv_sec member to represent time interval values that are not a multiple of seconds.
The timeval structure is used in Windows Sockets by the select function to specify the maximum time the function can take to complete. The time interval is a combination of the values in tv_sec and tv_usec members.
Several functions are added on Windows Vista and later that use the timeval structure. These functions include GetAddrInfoEx, SetAddrInfoEx, WSAConnectByList, and WSAConnectByName.
Header: Declared in winsock2.h.
Library: Use ws2_32.lib.