2 * This file defines functions that are required for unix compatibility.
4 * These functions are not available in the Microsoft C/C++ Run Time
7 * The following functions list may not be complete
10 * SHARED _gettimeofday
16 #include <winsock.h> /* For definition of "timeval" structure */
17 #include <sys/timeb.h> /* For prototype of "_ftime()" */
21 * gettimeofday() -- gets the current time in elapsed seconds and
22 * microsends since GMT Jan 1, 1970.
24 * ARGUMENTS: - Pointer to a timeval struct to return the time into
26 * RETURN CODES: - 0 on success
29 int gettimeofday(curTimeP
)
30 struct timeval
*curTimeP
;
32 struct _timeb localTime
;
34 if (curTimeP
== (struct timeval
*) 0)
41 * Compute the elapsed time since Jan 1, 1970 by first
42 * obtaining the elapsed time from the system using the
43 * _ftime(..) call and then convert to the "timeval"
49 curTimeP
->tv_sec
= localTime
.time
+ localTime
.timezone
;
50 curTimeP
->tv_usec
= localTime
.millitm
* 1000;