ruby-changes:42557
From: naruse <ko1@a...>
Date: Mon, 18 Apr 2016 15:37:19 +0900 (JST)
Subject: [ruby-changes:42557] naruse:r54631 (ruby_2_3): merge revision(s) 54444: [Backport #12233]
naruse 2016-04-18 16:33:56 +0900 (Mon, 18 Apr 2016) New Revision: 54631 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54631 Log: merge revision(s) 54444: [Backport #12233] * ext/date/date_core.c (Init_date_core): [DOC] fix misplaced doc of DateTime. [ruby-core:74729] [Bug #12233] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/ext/date/date_core.c branches/ruby_2_3/version.h Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 54630) +++ ruby_2_3/ChangeLog (revision 54631) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Mon Apr 18 16:33:50 2016 Nobuyoshi Nakada <nobu@r...> + + * ext/date/date_core.c (Init_date_core): [DOC] fix misplaced doc + of DateTime. [ruby-core:74729] [Bug #12233] + Mon Apr 18 13:48:05 2016 Nobuyoshi Nakada <nobu@r...> * cygwin/GNUmakefile.in (MSYS2_ARG_CONV_EXCL_PARAM): Index: ruby_2_3/ext/date/date_core.c =================================================================== --- ruby_2_3/ext/date/date_core.c (revision 54630) +++ ruby_2_3/ext/date/date_core.c (revision 54631) @@ -9170,67 +9170,6 @@ Init_date_core(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/date/date_core.c#L9170 * d += 1 #=> #<Date: 2001-02-04 ...> * d.strftime('%a %d %b %Y') #=> "Sun 04 Feb 2001" * - * - * == DateTime - * - * A subclass of Date that easily handles date, hour, minute, second and - * offset. - * - * DateTime does not consider any leap seconds, does not track - * any summer time rules. - * - * DateTime object is created with DateTime::new, DateTime::jd, - * DateTime::ordinal, DateTime::commercial, DateTime::parse, - * DateTime::strptime, DateTime::now, Time#to_datetime or etc. - * - * require 'date' - * - * DateTime.new(2001,2,3,4,5,6) - * #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...> - * - * The last element of day, hour, minute or second can be - * fractional number. The fractional number's precision is assumed - * at most nanosecond. - * - * DateTime.new(2001,2,3.5) - * #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...> - * - * An optional argument the offset indicates the difference - * between the local time and UTC. For example, Rational(3,24) - * represents ahead of 3 hours of UTC, Rational(-5,24) represents - * behind of 5 hours of UTC. The offset should be -1 to +1, and - * its precision is assumed at most second. The default value is - * zero(equals to UTC). - * - * DateTime.new(2001,2,3,4,5,6,Rational(3,24)) - * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...> - * - * also accepts string form. - * - * DateTime.new(2001,2,3,4,5,6,'+03:00') - * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...> - * - * An optional argument the day of calendar reform (start) denotes - * a Julian day number, which should be 2298874 to 2426355 or - * -/+oo. The default value is Date::ITALY (2299161=1582-10-15). - * - * DateTime object has various methods. See each reference. - * - * d = DateTime.parse('3rd Feb 2001 04:05:06+03:30') - * #=> #<DateTime: 2001-02-03T04:05:06+03:30 ...> - * d.hour #=> 4 - * d.min #=> 5 - * d.sec #=> 6 - * d.offset #=> (7/48) - * d.zone #=> "+03:30" - * d += Rational('1.5') - * #=> #<DateTime: 2001-02-04%16:05:06+03:30 ...> - * d = d.new_offset('+09:00') - * #=> #<DateTime: 2001-02-04%21:35:06+09:00 ...> - * d.strftime('%I:%M:%S %p') - * #=> "09:35:06 PM" - * d > DateTime.new(1999) - * #=> true */ cDate = rb_define_class("Date", rb_cObject); @@ -9481,6 +9420,67 @@ Init_date_core(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/date/date_core.c#L9420 /* :markup: Markdown + ## DateTime + + A subclass of Date that easily handles date, hour, minute, second and + offset. + + DateTime does not consider any leap seconds, does not track + any summer time rules. + + DateTime object is created with DateTime::new, DateTime::jd, + DateTime::ordinal, DateTime::commercial, DateTime::parse, + DateTime::strptime, DateTime::now, Time#to_datetime or etc. + + require 'date' + + DateTime.new(2001,2,3,4,5,6) + #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...> + + The last element of day, hour, minute or second can be + fractional number. The fractional number's precision is assumed + at most nanosecond. + + DateTime.new(2001,2,3.5) + #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...> + + An optional argument the offset indicates the difference + between the local time and UTC. For example, `Rational(3,24)` + represents ahead of 3 hours of UTC, `Rational(-5,24)` represents + behind of 5 hours of UTC. The offset should be -1 to +1, and + its precision is assumed at most second. The default value is + zero(equals to UTC). + + DateTime.new(2001,2,3,4,5,6,Rational(3,24)) + #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...> + + also accepts string form. + + DateTime.new(2001,2,3,4,5,6,'+03:00') + #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...> + + An optional argument the day of calendar reform (start) denotes + a Julian day number, which should be 2298874 to 2426355 or + -/+oo. The default value is `Date::ITALY` (2299161=1582-10-15). + + DateTime object has various methods. See each reference. + + d = DateTime.parse('3rd Feb 2001 04:05:06+03:30') + #=> #<DateTime: 2001-02-03T04:05:06+03:30 ...> + d.hour #=> 4 + d.min #=> 5 + d.sec #=> 6 + d.offset #=> (7/48) + d.zone #=> "+03:30" + d += Rational('1.5') + #=> #<DateTime: 2001-02-04%16:05:06+03:30 ...> + d = d.new_offset('+09:00') + #=> #<DateTime: 2001-02-04%21:35:06+09:00 ...> + d.strftime('%I:%M:%S %p') + #=> "09:35:06 PM" + d > DateTime.new(1999) + #=> true + ### When should you use DateTime and when should you use Time? It's a common misconception that [William Shakespeare][1] and Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 54630) +++ ruby_2_3/version.h (revision 54631) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.0" #define RUBY_RELEASE_DATE "2016-04-18" -#define RUBY_PATCHLEVEL 86 +#define RUBY_PATCHLEVEL 87 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 4 Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r54444 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/