summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 0dfe3e513c..e170f1b226 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2495,13 +2495,23 @@ waitpid (pid_t pid, int *stat_loc, int options)
int _cdecl
gettimeofday(struct timeval *tv, struct timezone *tz)
{
- struct timeb tb;
+ SYSTEMTIME st;
+ time_t t;
+ struct tm tm;
+
+ GetLocalTime(&st);
+ tm.tm_sec = st.wSecond;
+ tm.tm_min = st.wMinute;
+ tm.tm_hour = st.wHour;
+ tm.tm_mday = st.wDay;
+ tm.tm_mon = st.wMonth - 1;
+ tm.tm_year = st.wYear - 1900;
+ tm.tm_isdst = -1;
+ t = mktime(&tm);
+ tv->tv_sec = t;
+ tv->tv_usec = st.wMilliseconds * 1000;
- ftime(&tb);
- tv->tv_sec = tb.time;
- tv->tv_usec = tb.millitm * 1000;
-
- return 0;
+ return 0;
}
char *