diff options
author | Artur Bergman <sky@nanisky.com> | 2001-09-25 13:37:12 +0000 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2001-09-25 13:37:12 +0000 |
commit | 920aa6e3b70bf37dd398a673ab4c0e7575ffbd42 (patch) | |
tree | eb659ade3bf411d12a9286b915b3414e43e33cc8 /ext | |
parent | afdf8da689293f33e16617c81015d0194df5fa40 (diff) | |
download | perl-920aa6e3b70bf37dd398a673ab4c0e7575ffbd42.tar.gz |
Second attempt at fixing Time::HiRes::time on win32. Apperently if ENV{TZ} is wrong we fail. New attempt uses
_ftime to try and be more robust.
p4raw-id: //depot/perl@12196
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Time/HiRes/HiRes.xs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs index a4bf2dfd0d..a0349fa698 100644 --- a/ext/Time/HiRes/HiRes.xs +++ b/ext/Time/HiRes/HiRes.xs @@ -62,26 +62,15 @@ struct timeval { long tv_usec; } */ +#include <sys/timeb.h> int gettimeofday (struct timeval *tp, int nothing) { - SYSTEMTIME st; - time_t tt; - struct tm tmtm; - /* mktime converts local to UTC */ - GetLocalTime (&st); - tmtm.tm_sec = st.wSecond; - tmtm.tm_min = st.wMinute; - tmtm.tm_hour = st.wHour; - tmtm.tm_mday = st.wDay; - tmtm.tm_mon = st.wMonth - 1; - tmtm.tm_year = st.wYear - 1900; - tmtm.tm_wday = st.wDayOfWeek; - tmtm.tm_isdst = -1; - tt = mktime (&tmtm); - tp->tv_sec = tt; - tp->tv_usec = st.wMilliseconds * 1000; + struct _timeb timebuffer; + _ftime( &timebuffer ); + tp->tv_sec = timebuffer.time; + tp->tv_usec = timebuffer.millitm * 1000; return 0; } #endif |