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

ruby-changes:7533

From: usa <ko1@a...>
Date: Tue, 2 Sep 2008 10:53:07 +0900 (JST)
Subject: [ruby-changes:7533] Ruby:r19054 (ruby_1_8): * win32/win32.c (gettimeofday): easier calculation. use the definition

usa	2008-09-02 10:52:46 +0900 (Tue, 02 Sep 2008)

  New Revision: 19054

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

  Log:
    * win32/win32.c (gettimeofday): easier calculation. use the definition
      of the Gregorian calender.

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

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 19053)
+++ ruby_1_8/ChangeLog	(revision 19054)
@@ -1,3 +1,8 @@
+Tue Sep  2 10:52:34 2008  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (gettimeofday): easier calculation. use the definition
+	  of the Gregorian calender.
+
 Tue Sep  2 10:18:58 2008  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (gettimeofday): calc tv_sec and tv_usec from system
Index: ruby_1_8/win32/win32.c
===================================================================
--- ruby_1_8/win32/win32.c	(revision 19053)
+++ ruby_1_8/win32/win32.c	(revision 19054)
@@ -2992,7 +2992,7 @@
        the first leap second is at 1972/06/30, so we doesn't need to think
        about it. */
     lt /= 10000;	/* to msec */
-    lt -= (LONG_LONG)(369 * 365 + 24 * 3 + 17) * 24 * 60 * 60 * 1000;
+    lt -= (LONG_LONG)((1970-1601)*365.2425) * 24 * 60 * 60 * 1000;
 
     tv->tv_sec = lt / 1000;
     tv->tv_usec = lt % 1000;

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

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