[前][次][番号順一覧][スレッド一覧]

ruby-changes:7504

From: usa <ko1@a...>
Date: Mon, 1 Sep 2008 18:32:02 +0900 (JST)
Subject: [ruby-changes:7504] Ruby:r19025 (ruby_1_8): * win32/win32.c (gettimeofday): shouldn't use mktime(2) because it's

usa	2008-09-01 18:31:53 +0900 (Mon, 01 Sep 2008)

  New Revision: 19025

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19025

  Log:
    * win32/win32.c (gettimeofday): shouldn't use mktime(2) because it's
      buggy about handling summer time.
      reported by Yoshikawa <yoshixool AT gmail.com> at [ruby-dev:36071]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/win32/win32.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 19024)
+++ ruby_1_8/ChangeLog	(revision 19025)
@@ -1,3 +1,9 @@
+Mon Sep  1 18:31:10 2008  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (gettimeofday): shouldn't use mktime(2) because it's
+	  buggy about handling summer time.
+	  reported by Yoshikawa <yoshixool AT gmail.com> at [ruby-dev:36071]
+
 Sun Aug 31 18:22:04 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/mkmf.rb (have_devel?): checks if the compiler works.
Index: ruby_1_8/win32/win32.c
===================================================================
--- ruby_1_8/win32/win32.c	(revision 19024)
+++ ruby_1_8/win32/win32.c	(revision 19025)
@@ -2979,19 +2979,10 @@
 gettimeofday(struct timeval *tv, struct timezone *tz)
 {
     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;
+    GetSystemTime(&st);
+    time(&tv->tv_sec);
     tv->tv_usec = st.wMilliseconds * 1000;
 
     return 0;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]