* win32/win32.c (unixtime_to_filetime): deal with DST.

[ruby-talk:141817]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2005-05-15 00:57:49 +00:00
parent a7c5e6bcec
commit c23d3e4640
2 changed files with 8 additions and 1 deletions

View file

@ -3490,6 +3490,7 @@ unixtime_to_filetime(time_t time, FILETIME *ft)
{
struct tm *tm;
SYSTEMTIME st;
FILETIME lt;
tm = gmtime(&time);
st.wYear = tm->tm_year + 1900;
@ -3500,7 +3501,8 @@ unixtime_to_filetime(time_t time, FILETIME *ft)
st.wMinute = tm->tm_min;
st.wSecond = tm->tm_sec;
st.wMilliseconds = 0;
if (!SystemTimeToFileTime(&st, ft)) {
if (!SystemTimeToFileTime(&st, &lt) ||
!LocalFileTimeToFileTime(&lt, ft)) {
errno = map_errno(GetLastError());
return -1;
}