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

ruby-changes:19155

From: naruse <ko1@a...>
Date: Mon, 28 Mar 2011 11:52:57 +0900 (JST)
Subject: [ruby-changes:19155] Ruby:r31194 (trunk): * ext/date/date_core.c (date_s_today): use int for year.

naruse	2011-03-28 11:41:31 +0900 (Mon, 28 Mar 2011)

  New Revision: 31194

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

  Log:
    * ext/date/date_core.c (date_s_today): use int for year.
    
    * ext/date/date_core.c (datetime_s_now): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_core.c
    trunk/test/date/test_date_base.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31193)
+++ ChangeLog	(revision 31194)
@@ -1,3 +1,9 @@
+Mon Mar 28 11:38:08 2011  NARUSE, Yui  <naruse@r...>
+
+	* ext/date/date_core.c (date_s_today): use int for year.
+
+	* ext/date/date_core.c (datetime_s_now): ditto.
+
 Mon Mar 28 11:07:41 2011  NAKAMURA Usaku  <usa@r...>
 
 	* ext/extmk.rb: set MFLAGS from MAKEFLAGS when using nmake.
Index: ext/date/date_core.c
===================================================================
--- ext/date/date_core.c	(revision 31193)
+++ ext/date/date_core.c	(revision 31194)
@@ -1321,7 +1321,7 @@
     double sg;
     time_t t;
     struct tm tm;
-    long y;
+    int y;
     int m, d;
 
     rb_scan_args(argc, argv, "01", &vsg);
@@ -1343,15 +1343,15 @@
 	rb_raise(rb_eArgError, "cannot create");
 
     if (isinf(sg) && sg < 0)
-	return d_lite_s_new_internal(klass, 0, sg, (int)y, m, d,
+	return d_lite_s_new_internal(klass, 0, sg, y, m, d,
 				     LIGHT_MODE | HAVE_CIVIL);
     else {
 	long jd;
 	int ns;
 
-	civil_to_jd((int)y, m, d, sg, &jd, &ns);
+	civil_to_jd(y, m, d, sg, &jd, &ns);
 
-	return d_lite_s_new_internal(klass, jd, sg, (int)y, m, d,
+	return d_lite_s_new_internal(klass, jd, sg, y, m, d,
 				     LIGHT_MODE | HAVE_JD | HAVE_CIVIL);
     }
 }
@@ -3022,8 +3022,8 @@
 #endif
     time_t sec;
     struct tm tm;
-    long y, sf;
-    int m, d, h, min, s, of;
+    long sf;
+    int y, m, d, h, min, s, of;
 
     rb_scan_args(argc, argv, "01", &vsg);
 
@@ -3067,20 +3067,20 @@
 
     if (isinf(sg) && sg < 0)
 	return dt_lite_s_new_internal(klass, 0, 0, sf, of, sg,
-				      (int)y, m, d, h, min, s,
+				      y, m, d, h, min, s,
 				      LIGHT_MODE | HAVE_CIVIL | HAVE_TIME);
     else {
 	long jd;
 	int ns;
 
-	civil_to_jd((int)y, m, d, sg, &jd, &ns);
+	civil_to_jd(y, m, d, sg, &jd, &ns);
 
 	return dt_lite_s_new_internal(klass,
 				      jd_local_to_utc(jd,
 						      time_to_df(h, min, s),
 						      of),
 				      0, sf, of, sg,
-				      (int)y, m, d, h, min, s,
+				      y, m, d, h, min, s,
 				      LIGHT_MODE | HAVE_JD |
 				      HAVE_CIVIL | HAVE_TIME);
     }
Index: test/date/test_date_base.rb
===================================================================
--- test/date/test_date_base.rb	(revision 31193)
+++ test/date/test_date_base.rb	(revision 31194)
@@ -193,6 +193,10 @@
     end
   end
 
+  def test_jd
+    assert_equal(1<<33, Date.jd(1<<33))
+  end
+
   def test_mjd
     jd = Date.__send__(:mjd_to_jd, 51321)
     mjd = Date.__send__(:jd_to_mjd, jd)

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

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