1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/date/date_core.c: modified doc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2011-06-30 11:05:24 +00:00
parent fa2c1c75a9
commit 97772985f0
2 changed files with 74 additions and 59 deletions

View file

@ -1,3 +1,7 @@
Thu Jun 30 20:03:39 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c: modified doc.
Thu Jun 30 19:09:19 2011 Koichi Sasada <ko1@atdot.net>
* thread_pthread.c (thread_timer): ignore unknown errno.

View file

@ -229,11 +229,19 @@ f_negative_p(VALUE x)
#endif
#endif
/* A set of nth, jd, df and sf denote ajd + 1/2. Each ajd begin at
* noon of GMT (assume equal to UTC). However, this begins at
* midnight.
*/
struct SimpleDateData
{
unsigned flags;
VALUE nth; /* not always canonicalized */
int jd; /* as utc */
/* df is zero */
/* sf is zero */
/* of is zero */
#ifndef USE_FLOAT
double sg; /* 2298874..2426355 or -/+oo */
#else
@ -244,6 +252,9 @@ struct SimpleDateData
#ifndef USE_PACK
int mon;
int mday;
/* hour is zero */
/* min is zero */
/* sec is zero */
#else
/* packed civil */
unsigned pc;
@ -4089,7 +4100,7 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
/*
* call-seq:
* Date._strptime(string[, format="%F"]) -> hash
* Date._strptime(string[, format='%F']) -> hash
*
* Parses the given representation of date and time with the given
* template, and returns a hash of parsed elements.
@ -4109,7 +4120,7 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* Date.strptime([string="-4712-01-01"[, format="%F"[, start=ITALY]]]) -> date
* Date.strptime([string='-4712-01-01'[, format='%F'[, start=ITALY]]]) -> date
*
* Parses the given representation of date and time with the given
* template, and creates a date object.
@ -4205,7 +4216,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* Date.parse(string="-4712-01-01"[, comp=true[, start=ITALY]]) -> date
* Date.parse(string='-4712-01-01'[, comp=true[, start=ITALY]]) -> date
*
* Parses the given representation of date and time, and creates a
* date object.
@ -4267,10 +4278,10 @@ date_s__iso8601(VALUE klass, VALUE str)
/*
* call-seq:
* Date.iso8601(string="-4712-01-01"[, start=ITALY]) -> date
* Date.iso8601(string='-4712-01-01'[, start=ITALY]) -> date
*
* Creates a new Date object by parsing from a string according to
* some typical ISO 8601 format.
* some typical ISO 8601 formats.
*
* For example:
*
@ -4312,10 +4323,10 @@ date_s__rfc3339(VALUE klass, VALUE str)
/*
* call-seq:
* Date.rfc3339(string="-4712-01-01T00:00:00+00:00"[, start=ITALY]) -> date
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> date
*
* Creates a new Date object by parsing from a string according to
* some typical RFC 3339 format.
* some typical RFC 3339 formats.
*
* For example:
*
@ -4355,10 +4366,10 @@ date_s__xmlschema(VALUE klass, VALUE str)
/*
* call-seq:
* Date.xmlschema(string="-4712-01-01"[, start=ITALY]) -> date
* Date.xmlschema(string='-4712-01-01'[, start=ITALY]) -> date
*
* Creates a new Date object by parsing from a string according to
* some typical XML Schema format.
* some typical XML Schema formats.
*
* For example:
*
@ -4399,11 +4410,11 @@ date_s__rfc2822(VALUE klass, VALUE str)
/*
* call-seq:
* Date.rfc2822(string="Mon, 1 Jan -4712 00:00:00 +0000"[, start=ITALY]) -> date
* Date.rfc822(string="Mon, 1 Jan -4712 00:00:00 +0000"[, start=ITALY]) -> date
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> date
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> date
*
* Creates a new Date object by parsing from a string according to
* some typical RFC 2822 format.
* some typical RFC 2822 formats.
*
* For example:
*
@ -4444,7 +4455,7 @@ date_s__httpdate(VALUE klass, VALUE str)
/*
* call-seq:
* Date.httpdate(string="Mon, 01 Jan -4712 00:00:00 GMT"[, start=ITALY]) -> date
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=ITALY]) -> date
*
* Creates a new Date object by parsing from a string according to
* some RFC 2616 format.
@ -4489,10 +4500,10 @@ date_s__jisx0301(VALUE klass, VALUE str)
/*
* call-seq:
* Date.jisx0301(string="-4712-01-01"[, start=ITALY]) -> date
* Date.jisx0301(string='-4712-01-01'[, start=ITALY]) -> date
*
* Creates a new Date object by parsing from a string according to
* some typical JIS X 0301 format.
* some typical JIS X 0301 formats.
*
* For example:
*
@ -5420,8 +5431,8 @@ d_lite_new_offset(int argc, VALUE *argv, VALUE self)
* d + other -> date
*
* Returns a date object pointing other days after self. The other
* should be a numeric value. If the other is flonum, its precision
* is at most nanosecond.
* should be a numeric value. If the other is flonum, assumes its
* precision is at most nanosecond.
*
* For example:
*
@ -5824,12 +5835,12 @@ minus_dd(VALUE self, VALUE other)
/*
* call-seq:
* d - other -> date or numeric
* d - other -> date or rational
*
* Returns the difference between the two dates if the other is a date
* object. If the other is a numeric value, it returns a date object
* pointing other days before self. If the other is flonum, its
* precision is at most nanosecond.
* object. If the other is a numeric value, returns a date object
* pointing other days before self. If the other is flonum, assumes
* its precision is at most nanosecond.
*
* For example:
*
@ -6743,7 +6754,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
/*
* call-seq:
* d.strftime([format="%F"]) -> string
* d.strftime([format='%F']) -> string
*
* Formats date according to the directives in the given format
* string.
@ -7796,7 +7807,7 @@ dt_new_by_frags(VALUE klass, VALUE hash, VALUE sg)
/*
* call-seq:
* DateTime._strptime(string[, format="%FT%T%z"]) -> hash
* DateTime._strptime(string[, format='%FT%T%z']) -> hash
*
* Parses the given representation of date and time with the given
* template, and returns a hash of parsed elements.
@ -7811,7 +7822,7 @@ datetime_s__strptime(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.strptime([string="-4712-01-01T00:00:00+00:00"[, format="%FT%T%z"[ ,start=ITALY]]]) -> datetime
* DateTime.strptime([string='-4712-01-01T00:00:00+00:00'[, format='%FT%T%z'[ ,start=ITALY]]]) -> datetime
*
* Parses the given representation of date and time with the given
* template, and creates a date object.
@ -7865,7 +7876,7 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.parse(string="-4712-01-01T00:00:00+00:00"[, comp=true[, start=ITALY]]) -> datetime
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=ITALY]]) -> datetime
*
* Parses the given representation of date and time, and creates a
* date object.
@ -7910,10 +7921,10 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.iso8601(string="-4712-01-01T00:00:00+00:00"[, start=ITALY]) -> datetime
* DateTime.iso8601(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
*
* Creates a new Date object by parsing from a string according to
* some typical ISO 8601 format.
* some typical ISO 8601 formats.
*
* For example:
*
@ -7946,10 +7957,10 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.rfc3339(string="-4712-01-01T00:00:00+00:00"[, start=ITALY]) -> datetime
* DateTime.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
*
* Creates a new Date object by parsing from a string according to
* some typical RFC 3339 format.
* some typical RFC 3339 formats.
*
* For example:
*
@ -7978,10 +7989,10 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.xmlschema(string="-4712-01-01T00:00:00+00:00"[, start=ITALY]) -> datetime
* DateTime.xmlschema(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
*
* Creates a new Date object by parsing from a string according to
* some typical XML Schema format.
* some typical XML Schema formats.
*
* For example:
*
@ -8010,11 +8021,11 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.rfc2822(string="Mon, 1 Jan -4712 00:00:00 +0000"[, start=ITALY]) -> datetime
* DateTime.rfc822(string="Mon, 1 Jan -4712 00:00:00 +0000"[, start=ITALY]) -> datetime
* DateTime.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> datetime
* DateTime.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> datetime
*
* Creates a new Date object by parsing from a string according to
* some typical RFC 2822 format.
* some typical RFC 2822 formats.
*
* For example:
*
@ -8043,7 +8054,7 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.httpdate(string="Mon, 01 Jan -4712 00:00:00 GMT"[, start=ITALY]) -> datetime
* DateTime.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=ITALY]) -> datetime
*
* Creates a new Date object by parsing from a string according to
* some RFC 2616 format.
@ -8075,10 +8086,10 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* DateTime.jisx0301(string="-4712-01-01T00:00:00+00:00"[, start=ITALY]) -> datetime
* DateTime.jisx0301(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> datetime
*
* Creates a new Date object by parsing from a string according to
* some typical JIS X 0301 format.
* some typical JIS X 0301 formats.
*
* For example:
*
@ -8125,7 +8136,7 @@ dt_lite_to_s(VALUE self)
/*
* call-seq:
* dt.strftime([format="%FT%T%:z"]) -> string
* dt.strftime([format='%FT%T%:z']) -> string
*
* Formats date according to the directives in the given format
* string.
@ -9177,8 +9188,8 @@ Init_date_core(void)
* #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...>
*
* The last element of day, hour, minute or senond can be
* fractional number. The fractional number's precision is at most
* nanosecond.
* 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 ...>
@ -9187,8 +9198,8 @@ Init_date_core(void)
* 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 at most second. The default value is zero
* (equals to UTC).
* 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-03T03:04:05+03:00 ...>