зеркало из https://github.com/github/ruby.git
* time.c (time_timespec): check out-of-range. [ruby-core:23282]
[Bug #1396] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
258ed42c12
Коммит
a397887e58
|
@ -1,6 +1,7 @@
|
|||
Wed Apr 22 19:33:13 2009 Tanaka Akira <akr@fsij.org>
|
||||
Wed Apr 22 20:25:24 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/time.rb (Time.parse): use year completion in Date._parse.
|
||||
* time.c (time_timespec): check out-of-range. [ruby-core:23282]
|
||||
[Bug #1396]
|
||||
|
||||
Wed Apr 22 11:12:15 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
|
|
9
time.c
9
time.c
|
@ -1217,7 +1217,14 @@ time_timespec(VALUE num, int interval)
|
|||
if (f != t.tv_sec) {
|
||||
rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT_VALUE(num));
|
||||
}
|
||||
t.tv_nsec = (long)(d*1e9+0.5);
|
||||
t.tv_nsec = (int)(d*1e9+0.5);
|
||||
if (t.tv_nsec >= 1000000000) {
|
||||
t.tv_nsec -= 1000000000;
|
||||
if (++t.tv_sec <= 0) {
|
||||
--t.tv_nsec;
|
||||
t.tv_nsec = 999999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче