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

ruby-changes:7543

From: usa <ko1@a...>
Date: Tue, 2 Sep 2008 14:52:18 +0900 (JST)
Subject: [ruby-changes:7543] Ruby:r19064 (ruby_1_8): * win32/win32.c (gettimeofday): tv_usec is usec, not msec.

usa	2008-09-02 14:49:10 +0900 (Tue, 02 Sep 2008)

  New Revision: 19064

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

  Log:
    * win32/win32.c (gettimeofday): tv_usec is usec, not msec.
      [ruby-dev:36094]

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

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 19063)
+++ ruby_1_8/ChangeLog	(revision 19064)
@@ -1,7 +1,12 @@
+Tue Sep  2 14:48:55 2008  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (gettimeofday): tv_usec is usec, not msec.
+	  [ruby-dev:36094]
+
 Tue Sep  2 10:52:34 2008  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (gettimeofday): easier calculation. use the definition
-	  of the Gregorian calender.
+	  of the Gregorian calendar.
 
 Tue Sep  2 10:18:58 2008  NAKAMURA Usaku  <usa@r...>
 
Index: ruby_1_8/win32/win32.c
===================================================================
--- ruby_1_8/win32/win32.c	(revision 19063)
+++ ruby_1_8/win32/win32.c	(revision 19064)
@@ -2991,11 +2991,11 @@
        convert it into UNIX time (since 1970/01/01 00:00:00 UTC).
        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)((1970-1601)*365.2425) * 24 * 60 * 60 * 1000;
+    lt /= 10;	/* to usec */
+    lt -= (LONG_LONG)((1970-1601)*365.2425) * 24 * 60 * 60 * 1000 * 1000;
 
-    tv->tv_sec = lt / 1000;
-    tv->tv_usec = lt % 1000;
+    tv->tv_sec = lt / (1000 * 1000);
+    tv->tv_usec = lt % (1000 * 1000);
 
     return 0;
 }

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

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