mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/date/date_core.c (date_s_today): use int for year.
* ext/date/date_core.c (datetime_s_now): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0dcb387abe
commit
09a4ae1bbc
3 changed files with 19 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Mar 28 11:38:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* ext/extmk.rb: set MFLAGS from MAKEFLAGS when using nmake.
|
||||
|
|
|
@ -1321,7 +1321,7 @@ date_s_today(int argc, VALUE *argv, VALUE klass)
|
|||
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 @@ date_s_today(int argc, VALUE *argv, VALUE klass)
|
|||
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 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
|
|||
#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 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -193,6 +193,10 @@ class TestDateBase < Test::Unit::TestCase
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue