int gettimeofday(struct timeval *tv, struct timezone *tz);
This system call implements the BSD gettimeofday function, which reads the current system time, and is used by the BSD C library to implement the POSIX time function.Because MOSS must implement this function as two separate DOS calls, one to get the date and the other to get the time, there is a slight chance of a race condition in which the returned value will be a day off if the function is called exactly at midnight. Oh well.
More seriously, the math used to calculate the Un*x-style timeval may currently be somewhat broken, producing inaccurate dates; this function is basically untested.
- tv
- If non-NULL, the specified structure is filled with the current time of day.
- tz
- Under BSD, if this parameter is non-NULL, the current timezone is stored in the provided structure. However, under MOSS, this paramter is not supported; if the application passes a non-NULL paramter, the gettimeofday call will fail.
Returns 0 if successful, or -1 on error, in which case errno indicates the error.