summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date.gemspec31
-rw-r--r--ext/date/date_core.c951
-rw-r--r--ext/date/date_parse.c75
-rw-r--r--ext/date/date_strptime.c117
-rw-r--r--ext/date/depend20
-rw-r--r--ext/date/extconf.rb1
-rw-r--r--ext/date/lib/date.rb2
-rw-r--r--ext/date/prereq.mk2
-rw-r--r--ext/date/zonetab.h1252
-rw-r--r--ext/date/zonetab.list9
10 files changed, 1358 insertions, 1102 deletions
diff --git a/ext/date/date.gemspec b/ext/date/date.gemspec
index eecbf786a3..cb439bd0a5 100644
--- a/ext/date/date.gemspec
+++ b/ext/date/date.gemspec
@@ -7,21 +7,30 @@ end
Gem::Specification.new do |s|
s.name = "date"
s.version = version
- s.summary = "A subclass of Object includes Comparable module for handling dates."
- s.description = "A subclass of Object includes Comparable module for handling dates."
+ s.summary = "The official date library for Ruby."
+ s.description = "The official date library for Ruby."
- s.require_path = %w{lib}
- s.files = [
- "README.md",
- "lib/date.rb", "ext/date/date_core.c", "ext/date/date_parse.c", "ext/date/date_strftime.c",
- "ext/date/date_strptime.c", "ext/date/date_tmx.h", "ext/date/extconf.rb", "ext/date/prereq.mk",
- "ext/date/zonetab.h", "ext/date/zonetab.list"
- ]
- s.extensions = "ext/date/extconf.rb"
- s.required_ruby_version = ">= 2.4.0"
+ if Gem::Platform === s.platform and s.platform =~ 'java' or RUBY_ENGINE == 'jruby'
+ s.platform = 'java'
+ # No files shipped, no require path, no-op for now on JRuby
+ else
+ s.require_path = %w{lib}
+
+ s.files = [
+ "README.md", "COPYING", "BSDL",
+ "lib/date.rb", "ext/date/date_core.c", "ext/date/date_parse.c", "ext/date/date_strftime.c",
+ "ext/date/date_strptime.c", "ext/date/date_tmx.h", "ext/date/extconf.rb", "ext/date/prereq.mk",
+ "ext/date/zonetab.h", "ext/date/zonetab.list"
+ ]
+ s.extensions = "ext/date/extconf.rb"
+ end
+
+ s.required_ruby_version = ">= 2.6.0"
s.authors = ["Tadayoshi Funaba"]
s.email = [nil]
s.homepage = "https://github.com/ruby/date"
s.licenses = ["Ruby", "BSD-2-Clause"]
+
+ s.metadata["changelog_uri"] = s.homepage + "/releases"
end
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index cee7b27faf..72d697c8ea 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -27,6 +27,10 @@ static VALUE eDateError;
static VALUE half_days_in_day, day_in_nanoseconds;
static double positive_inf, negative_inf;
+/* used by deconstruct_keys */
+static VALUE sym_year, sym_month, sym_day, sym_yday, sym_wday;
+static VALUE sym_hour, sym_min, sym_sec, sym_sec_fraction, sym_zone;
+
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
#define f_abs(x) rb_funcall(x, rb_intern("abs"), 0)
@@ -53,14 +57,15 @@ static double positive_inf, negative_inf;
#define f_add3(x,y,z) f_add(f_add(x, y), z)
#define f_sub3(x,y,z) f_sub(f_sub(x, y), z)
-#define f_frozen_ary(...) rb_obj_freeze(rb_ary_new3(__VA_ARGS__))
+#define f_frozen_ary(...) rb_ary_freeze(rb_ary_new3(__VA_ARGS__))
static VALUE date_initialize(int argc, VALUE *argv, VALUE self);
static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self);
#define RETURN_FALSE_UNLESS_NUMERIC(obj) if(!RTEST(rb_obj_is_kind_of((obj), rb_cNumeric))) return Qfalse
inline static void
-check_numeric(VALUE obj, const char* field) {
+check_numeric(VALUE obj, const char* field)
+{
if(!RTEST(rb_obj_is_kind_of(obj, rb_cNumeric))) {
rb_raise(rb_eTypeError, "invalid %s (not numeric)", field);
}
@@ -243,6 +248,11 @@ f_negative_p(VALUE x)
#define date_sg_t double
#endif
+#define JULIAN_EPOCH_DATE "-4712-01-01"
+#define JULIAN_EPOCH_DATETIME JULIAN_EPOCH_DATE "T00:00:00+00:00"
+#define JULIAN_EPOCH_DATETIME_RFC3339 "Mon, 1 Jan -4712 00:00:00 +0000"
+#define JULIAN_EPOCH_DATETIME_HTTPDATE "Mon, 01 Jan -4712 00:00:00 GMT"
+
/* 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.
@@ -442,11 +452,43 @@ do {\
static int c_valid_civil_p(int, int, int, double,
int *, int *, int *, int *);
+/* Check if using pure Gregorian calendar (sg == -Infinity) */
+#define c_gregorian_only_p(sg) (isinf(sg) && (sg) < 0)
+
+/*
+ * Fast path macros for pure Gregorian calendar.
+ * Sets *rjd to the JD value, *ns to 1 (new style), and returns.
+ */
+#define GREGORIAN_JD_FAST_PATH_RET(sg, jd_expr, rjd, ns) \
+ if (c_gregorian_only_p(sg)) { \
+ *(rjd) = (jd_expr); \
+ *(ns) = 1; \
+ return 1; \
+ }
+
+#define GREGORIAN_JD_FAST_PATH(sg, jd_expr, rjd, ns) \
+ if (c_gregorian_only_p(sg)) { \
+ *(rjd) = (jd_expr); \
+ *(ns) = 1; \
+ return; \
+ }
+
+/* Forward declarations for Neri-Schneider optimized functions */
+static int c_gregorian_civil_to_jd(int y, int m, int d);
+static void c_gregorian_jd_to_civil(int jd, int *ry, int *rm, int *rd);
+static int c_gregorian_fdoy(int y);
+static int c_gregorian_ldoy(int y);
+static int c_gregorian_ldom_jd(int y, int m);
+static int ns_jd_in_range(int jd);
+
static int
c_find_fdoy(int y, double sg, int *rjd, int *ns)
{
int d, rm, rd;
+ GREGORIAN_JD_FAST_PATH_RET(sg, c_gregorian_fdoy(y), rjd, ns);
+
+ /* Keep existing loop for Julian/reform period */
for (d = 1; d < 31; d++)
if (c_valid_civil_p(y, 1, d, sg, &rm, &rd, rjd, ns))
return 1;
@@ -458,6 +500,9 @@ c_find_ldoy(int y, double sg, int *rjd, int *ns)
{
int i, rm, rd;
+ GREGORIAN_JD_FAST_PATH_RET(sg, c_gregorian_ldoy(y), rjd, ns);
+
+ /* Keep existing loop for Julian/reform period */
for (i = 0; i < 30; i++)
if (c_valid_civil_p(y, 12, 31 - i, sg, &rm, &rd, rjd, ns))
return 1;
@@ -483,6 +528,9 @@ c_find_ldom(int y, int m, double sg, int *rjd, int *ns)
{
int i, rm, rd;
+ GREGORIAN_JD_FAST_PATH_RET(sg, c_gregorian_ldom_jd(y, m), rjd, ns);
+
+ /* Keep existing loop for Julian/reform period */
for (i = 0; i < 30; i++)
if (c_valid_civil_p(y, m, 31 - i, sg, &rm, &rd, rjd, ns))
return 1;
@@ -492,55 +540,69 @@ c_find_ldom(int y, int m, double sg, int *rjd, int *ns)
static void
c_civil_to_jd(int y, int m, int d, double sg, int *rjd, int *ns)
{
- double a, b, jd;
+ int jd;
+
+ GREGORIAN_JD_FAST_PATH(sg, c_gregorian_civil_to_jd(y, m, d), rjd, ns);
+
+ /* Calculate Gregorian JD using optimized algorithm */
+ jd = c_gregorian_civil_to_jd(y, m, d);
- if (m <= 2) {
- y -= 1;
- m += 12;
- }
- a = floor(y / 100.0);
- b = 2 - a + floor(a / 4.0);
- jd = floor(365.25 * (y + 4716)) +
- floor(30.6001 * (m + 1)) +
- d + b - 1524;
if (jd < sg) {
- jd -= b;
+ /* Before Gregorian switchover - use Julian calendar */
+ int y2 = y, m2 = m;
+ if (m2 <= 2) {
+ y2 -= 1;
+ m2 += 12;
+ }
+ jd = (int)(floor(365.25 * (y2 + 4716)) +
+ floor(30.6001 * (m2 + 1)) +
+ d - 1524);
*ns = 0;
}
- else
+ else {
*ns = 1;
+ }
- *rjd = (int)jd;
+ *rjd = jd;
}
static void
c_jd_to_civil(int jd, double sg, int *ry, int *rm, int *rdom)
{
- double x, a, b, c, d, e, y, m, dom;
-
- if (jd < sg)
- a = jd;
- else {
- x = floor((jd - 1867216.25) / 36524.25);
- a = jd + 1 + x - floor(x / 4.0);
- }
- b = a + 1524;
- c = floor((b - 122.1) / 365.25);
- d = floor(365.25 * c);
- e = floor((b - d) / 30.6001);
- dom = b - d - floor(30.6001 * e);
- if (e <= 13) {
- m = e - 1;
- y = c - 4716;
- }
- else {
- m = e - 13;
- y = c - 4715;
+ /* Fast path: pure Gregorian or date after switchover, within safe range */
+ if ((c_gregorian_only_p(sg) || jd >= sg) && ns_jd_in_range(jd)) {
+ c_gregorian_jd_to_civil(jd, ry, rm, rdom);
+ return;
}
- *ry = (int)y;
- *rm = (int)m;
- *rdom = (int)dom;
+ /* Original algorithm for Julian calendar or extreme dates */
+ {
+ double x, a, b, c, d, e, y, m, dom;
+
+ if (jd < sg)
+ a = jd;
+ else {
+ x = floor((jd - 1867216.25) / 36524.25);
+ a = jd + 1 + x - floor(x / 4.0);
+ }
+ b = a + 1524;
+ c = floor((b - 122.1) / 365.25);
+ d = floor(365.25 * c);
+ e = floor((b - d) / 30.6001);
+ dom = b - d - floor(30.6001 * e);
+ if (e <= 13) {
+ m = e - 1;
+ y = c - 4716;
+ }
+ else {
+ m = e - 13;
+ y = c - 4715;
+ }
+
+ *ry = (int)y;
+ *rm = (int)m;
+ *rdom = (int)dom;
+ }
}
static void
@@ -715,6 +777,147 @@ c_gregorian_last_day_of_month(int y, int m)
return monthtab[c_gregorian_leap_p(y) ? 1 : 0][m];
}
+/*
+ * Neri-Schneider algorithm for optimized Gregorian date conversion.
+ * Reference: Neri & Schneider, "Euclidean Affine Functions and Applications
+ * to Calendar Algorithms", Software: Practice and Experience, 2023.
+ * https://arxiv.org/abs/2102.06959
+ *
+ * This algorithm provides ~2-3x speedup over traditional floating-point
+ * implementations by using pure integer arithmetic with multiplication
+ * and bit-shifts instead of expensive division operations.
+ */
+
+/* JDN of March 1, Year 0 in proleptic Gregorian calendar */
+#define NS_EPOCH 1721120
+
+/* Days in a 4-year cycle (3 normal years + 1 leap year) */
+#define NS_DAYS_IN_4_YEARS 1461
+
+/* Days in a 400-year Gregorian cycle (97 leap years in 400 years) */
+#define NS_DAYS_IN_400_YEARS 146097
+
+/* Years per century */
+#define NS_YEARS_PER_CENTURY 100
+
+/*
+ * Multiplier for extracting year within century using fixed-point arithmetic.
+ * This is ceil(2^32 / NS_DAYS_IN_4_YEARS) for the Euclidean affine function.
+ */
+#define NS_YEAR_MULTIPLIER 2939745
+
+/*
+ * Coefficients for month calculation from day-of-year.
+ * Maps day-of-year to month using: month = (NS_MONTH_COEFF * doy + NS_MONTH_OFFSET) >> 16
+ */
+#define NS_MONTH_COEFF 2141
+#define NS_MONTH_OFFSET 197913
+
+/*
+ * Coefficients for civil date to JDN month contribution.
+ * Maps month to accumulated days: days = (NS_CIVIL_MONTH_COEFF * m - NS_CIVIL_MONTH_OFFSET) / 32
+ */
+#define NS_CIVIL_MONTH_COEFF 979
+#define NS_CIVIL_MONTH_OFFSET 2919
+#define NS_CIVIL_MONTH_DIVISOR 32
+
+/* Days from March 1 to December 31 (for Jan/Feb year adjustment) */
+#define NS_DAYS_BEFORE_NEW_YEAR 306
+
+/*
+ * Safe bounds for Neri-Schneider algorithm to avoid integer overflow.
+ * These correspond to approximately years -1,000,000 to +1,000,000.
+ */
+#define NS_JD_MIN -364000000
+#define NS_JD_MAX 538000000
+
+inline static int
+ns_jd_in_range(int jd)
+{
+ return jd >= NS_JD_MIN && jd <= NS_JD_MAX;
+}
+
+/* Optimized: Gregorian date -> Julian Day Number */
+static int
+c_gregorian_civil_to_jd(int y, int m, int d)
+{
+ /* Shift epoch to March 1 of year 0 (Jan/Feb belong to previous year) */
+ int j = (m < 3) ? 1 : 0;
+ int y0 = y - j;
+ int m0 = j ? m + 12 : m;
+ int d0 = d - 1;
+
+ /* Calculate year contribution with leap year correction */
+ int q1 = DIV(y0, NS_YEARS_PER_CENTURY);
+ int yc = DIV(NS_DAYS_IN_4_YEARS * y0, 4) - q1 + DIV(q1, 4);
+
+ /* Calculate month contribution using integer arithmetic */
+ int mc = (NS_CIVIL_MONTH_COEFF * m0 - NS_CIVIL_MONTH_OFFSET) / NS_CIVIL_MONTH_DIVISOR;
+
+ /* Combine and add epoch offset to get JDN */
+ return yc + mc + d0 + NS_EPOCH;
+}
+
+/* Optimized: Julian Day Number -> Gregorian date */
+static void
+c_gregorian_jd_to_civil(int jd, int *ry, int *rm, int *rd)
+{
+ int r0, n1, q1, r1, n2, q2, r2, n3, q3, r3, y0, j;
+ uint64_t u2;
+
+ /* Convert JDN to rata die (March 1, Year 0 epoch) */
+ r0 = jd - NS_EPOCH;
+
+ /* Extract century and day within 400-year cycle */
+ /* Use Euclidean (floor) division for negative values */
+ n1 = 4 * r0 + 3;
+ q1 = DIV(n1, NS_DAYS_IN_400_YEARS);
+ r1 = MOD(n1, NS_DAYS_IN_400_YEARS) / 4;
+
+ /* Calculate year within century and day of year */
+ n2 = 4 * r1 + 3;
+ /* Use 64-bit arithmetic to avoid overflow */
+ u2 = (uint64_t)NS_YEAR_MULTIPLIER * (uint64_t)n2;
+ q2 = (int)(u2 >> 32);
+ r2 = (int)((uint32_t)u2 / NS_YEAR_MULTIPLIER / 4);
+
+ /* Calculate month and day using integer arithmetic */
+ n3 = NS_MONTH_COEFF * r2 + NS_MONTH_OFFSET;
+ q3 = n3 >> 16;
+ r3 = (n3 & 0xFFFF) / NS_MONTH_COEFF;
+
+ /* Combine century and year */
+ y0 = NS_YEARS_PER_CENTURY * q1 + q2;
+
+ /* Adjust for January/February (shift from fiscal year) */
+ j = (r2 >= NS_DAYS_BEFORE_NEW_YEAR) ? 1 : 0;
+
+ *ry = y0 + j;
+ *rm = j ? q3 - 12 : q3;
+ *rd = r3 + 1;
+}
+
+/* O(1) first day of year for Gregorian calendar */
+inline static int
+c_gregorian_fdoy(int y)
+{
+ return c_gregorian_civil_to_jd(y, 1, 1);
+}
+
+/* O(1) last day of year for Gregorian calendar */
+inline static int
+c_gregorian_ldoy(int y)
+{
+ return c_gregorian_civil_to_jd(y, 12, 31);
+}
+
+/* O(1) last day of month (JDN) for Gregorian calendar */
+inline static int
+c_gregorian_ldom_jd(int y, int m)
+{
+ return c_gregorian_civil_to_jd(y, m, c_gregorian_last_day_of_month(y, m));
+}
+
static int
c_valid_julian_p(int y, int m, int d, int *rm, int *rd)
{
@@ -761,6 +964,8 @@ c_valid_civil_p(int y, int m, int d, double sg,
if (m < 0)
m += 13;
+ if (m < 1 || m > 12)
+ return 0;
if (d < 0) {
if (!c_find_ldom(y, m, sg, rjd, ns))
return 0;
@@ -1587,7 +1792,7 @@ m_ajd(union DateData *x)
if (simple_dat_p(x)) {
r = m_real_jd(x);
- if (FIXNUM_P(r) && FIX2LONG(r) <= (FIXNUM_MAX / 2)) {
+ if (FIXNUM_P(r) && FIX2LONG(r) <= (FIXNUM_MAX / 2) && FIX2LONG(r) >= (FIXNUM_MIN + 1) / 2) {
long ir = FIX2LONG(r);
ir = ir * 2 - 1;
return rb_rational_new2(LONG2FIX(ir), INT2FIX(2));
@@ -2486,7 +2691,7 @@ date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass)
*
* Date.valid_jd?(2451944) # => true
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd.
*/
@@ -2580,9 +2785,7 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass)
* Date.valid_date?(2001, 2, 29) # => false
* Date.valid_date?(2001, 2, -1) # => true
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
- *
- * Date.valid_date? is an alias for Date.valid_civil?.
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd, Date.new.
*/
@@ -2670,7 +2873,7 @@ date_s__valid_ordinal_p(int argc, VALUE *argv, VALUE klass)
* Date.valid_ordinal?(2001, 34) # => true
* Date.valid_ordinal?(2001, 366) # => false
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd, Date.ordinal.
*/
@@ -2760,7 +2963,7 @@ date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass)
*
* See Date.commercial.
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd, Date.commercial.
*/
@@ -2979,8 +3182,6 @@ date_s_julian_leap_p(VALUE klass, VALUE y)
* Date.gregorian_leap?(2000) # => true
* Date.gregorian_leap?(2001) # => false
*
- * Date.leap? is an alias for Date.gregorian_leap?.
- *
* Related: Date.julian_leap?.
*/
static VALUE
@@ -3342,7 +3543,7 @@ static VALUE d_lite_plus(VALUE, VALUE);
*
* Date.jd(Date::ITALY - 1).julian? # => true
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.new.
*/
@@ -3407,7 +3608,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass)
*
* Raises an exception if +yday+ is zero or out of range.
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd, Date.new.
*/
@@ -3484,9 +3685,7 @@ date_s_civil(int argc, VALUE *argv, VALUE klass)
* where +n+ is the number of days in the month;
* when the argument is negative, counts backward from the end of the month.
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
- *
- * Date.civil is an alias for Date.new.
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd.
*/
@@ -3592,7 +3791,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
* Date.commercial(2020, 1, 1).to_s # => "2019-12-30"
Date.commercial(2020, 1, 7).to_s # => "2020-01-05"
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* Related: Date.jd, Date.new, Date.ordinal.
*/
@@ -3777,7 +3976,7 @@ static void set_sg(union DateData *, double);
*
* Date.today.to_s # => "2022-07-06"
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
*/
static VALUE
@@ -3872,7 +4071,6 @@ static VALUE
rt_complete_frags(VALUE klass, VALUE hash)
{
static VALUE tab = Qnil;
- int g;
long e;
VALUE k, a, d;
@@ -3969,9 +4167,13 @@ rt_complete_frags(VALUE klass, VALUE hash)
rb_gc_register_mark_object(tab);
}
+ k = a = Qnil;
+
{
- long i, eno = 0, idx = 0;
+ long i, eno = 0;
+ VALUE t = Qnil;
+ e = 0;
for (i = 0; i < RARRAY_LEN(tab); i++) {
VALUE x, a;
@@ -3986,23 +4188,20 @@ rt_complete_frags(VALUE klass, VALUE hash)
n++;
if (n > eno) {
eno = n;
- idx = i;
+ t = x;
}
}
}
- if (eno == 0)
- g = 0;
- else {
- g = 1;
- k = RARRAY_AREF(RARRAY_AREF(tab, idx), 0);
- a = RARRAY_AREF(RARRAY_AREF(tab, idx), 1);
- e = eno;
+ if (eno > 0) {
+ k = RARRAY_AREF(t, 0);
+ a = RARRAY_AREF(t, 1);
}
+ e = eno;
}
d = Qnil;
- if (g && !NIL_P(k) && (RARRAY_LEN(a) - e)) {
+ if (!NIL_P(k) && (RARRAY_LEN(a) > e)) {
if (k == sym("ordinal")) {
if (NIL_P(ref_hash("year"))) {
if (NIL_P(d))
@@ -4089,7 +4288,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
}
}
- if (g && k == sym("time")) {
+ if (k == sym("time")) {
if (f_le_p(klass, cDateTime)) {
if (NIL_P(d))
d = date_s_today(0, (VALUE *)0, cDate);
@@ -4329,6 +4528,7 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
rb_scan_args(argc, argv, "11", &vstr, &vfmt);
StringValue(vstr);
+ if (argc > 1) StringValue(vfmt);
if (!rb_enc_str_asciicompat_p(vstr))
rb_raise(rb_eArgError,
"string should have ASCII compatible encoding");
@@ -4339,7 +4539,6 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
flen = strlen(default_fmt);
}
else {
- StringValue(vfmt);
if (!rb_enc_str_asciicompat_p(vfmt))
rb_raise(rb_eArgError,
"format should have ASCII compatible encoding");
@@ -4377,7 +4576,7 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
* Date._strptime('2001-02-03', '%Y-%m-%d') # => {:year=>2001, :mon=>2, :mday=>3}
*
* For other formats, see
- * {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html].
+ * {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc].
* (Unlike Date.strftime, does not support flags and width.)
*
* See also {strptime(3)}[https://man7.org/linux/man-pages/man3/strptime.3.html].
@@ -4406,10 +4605,10 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
* Date.strptime('sat3feb01', '%a%d%b%y') # => #<Date: 2001-02-03>
*
* For other formats, see
- * {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html].
+ * {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc].
* (Unlike Date.strftime, does not support flags and width.)
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
* See also {strptime(3)}[https://man7.org/linux/man-pages/man3/strptime.3.html].
*
@@ -4424,7 +4623,7 @@ date_s_strptime(int argc, VALUE *argv, VALUE klass)
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01");
+ str = rb_str_new2(JULIAN_EPOCH_DATE);
case 1:
fmt = rb_str_new2("%F");
case 2:
@@ -4458,17 +4657,10 @@ get_limit(VALUE opt)
#define rb_category_warn(category, fmt) rb_warn(fmt)
#endif
-static void
+static VALUE
check_limit(VALUE str, VALUE opt)
{
size_t slen, limit;
- if (NIL_P(str)) return;
- if (SYMBOL_P(str)) {
- rb_category_warn(RB_WARN_CATEGORY_DEPRECATED,
- "The ability to parse Symbol is an unintentional bug and is deprecated");
- str = rb_sym2str(str);
- }
-
StringValue(str);
slen = RSTRING_LEN(str);
limit = get_limit(opt);
@@ -4476,6 +4668,7 @@ check_limit(VALUE str, VALUE opt)
rb_raise(rb_eArgError,
"string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit);
}
+ return str;
}
static VALUE
@@ -4483,10 +4676,8 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
{
VALUE vstr, vcomp, hash, opt;
- rb_scan_args(argc, argv, "11:", &vstr, &vcomp, &opt);
- if (!NIL_P(opt)) argc--;
- check_limit(vstr, opt);
- StringValue(vstr);
+ argc = rb_scan_args(argc, argv, "11:", &vstr, &vcomp, &opt);
+ vstr = check_limit(vstr, opt);
if (!rb_enc_str_asciicompat_p(vstr))
rb_raise(rb_eArgError,
"string should have ASCII compatible encoding");
@@ -4505,6 +4696,9 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
* <b>Note</b>:
* This method recognizes many forms in +string+,
* but it is not a validator.
+ * For formats, see
+ * {"Specialized Format Strings" in Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc@Specialized+Format+Strings]
+ *
* If +string+ does not specify a valid date,
* the result is unpredictable;
* consider using Date._strptime instead.
@@ -4537,6 +4731,8 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
* <b>Note</b>:
* This method recognizes many forms in +string+,
* but it is not a validator.
+ * For formats, see
+ * {"Specialized Format Strings" in Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc@Specialized+Format+Strings]
* If +string+ does not specify a valid date,
* the result is unpredictable;
* consider using Date._strptime instead.
@@ -4556,7 +4752,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
* Related: Date._parse (returns a hash).
@@ -4566,12 +4762,11 @@ date_s_parse(int argc, VALUE *argv, VALUE klass)
{
VALUE str, comp, sg, opt;
- rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01");
+ str = rb_str_new2(JULIAN_EPOCH_DATE);
case 1:
comp = Qtrue;
case 2:
@@ -4601,7 +4796,7 @@ VALUE date__jisx0301(VALUE);
* Date._iso8601(string, limit: 128) -> hash
*
* Returns a hash of values parsed from +string+, which should contain
- * an {ISO 8601 formatted date}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html#label-ISO+8601+Format+Specifications]:
+ * an {ISO 8601 formatted date}[rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specifications]:
*
* d = Date.new(2001, 2, 3)
* s = d.iso8601 # => "2001-02-03"
@@ -4617,7 +4812,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
- check_limit(str, opt);
+ if (!NIL_P(str)) str = check_limit(str, opt);
return date__iso8601(str);
}
@@ -4628,7 +4823,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
*
* Returns a new \Date object with values parsed from +string+,
* which should contain
- * an {ISO 8601 formatted date}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html#label-ISO+8601+Format+Specifications]:
+ * an {ISO 8601 formatted date}[rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specifications]:
*
* d = Date.new(2001, 2, 3)
* s = d.iso8601 # => "2001-02-03"
@@ -4636,7 +4831,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
* Related: Date._iso8601 (returns a hash).
@@ -4646,12 +4841,11 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01");
+ str = rb_str_new2(JULIAN_EPOCH_DATE);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -4671,7 +4865,7 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass)
* Date._rfc3339(string, limit: 128) -> hash
*
* Returns a hash of values parsed from +string+, which should be a valid
- * {RFC 3339 format}[https://datatracker.ietf.org/doc/html/rfc3339]:
+ * {RFC 3339 format}[rdoc-ref:language/strftime_formatting.rdoc@RFC+3339+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.rfc3339 # => "2001-02-03T00:00:00+00:00"
@@ -4688,7 +4882,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
- check_limit(str, opt);
+ if (!NIL_P(str)) str = check_limit(str, opt);
return date__rfc3339(str);
}
@@ -4699,7 +4893,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
*
* Returns a new \Date object with values parsed from +string+,
* which should be a valid
- * {RFC 3339 format}[https://datatracker.ietf.org/doc/html/rfc3339]:
+ * {RFC 3339 format}[rdoc-ref:language/strftime_formatting.rdoc@RFC+3339+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.rfc3339 # => "2001-02-03T00:00:00+00:00"
@@ -4707,7 +4901,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
* Related: Date._rfc3339 (returns a hash).
@@ -4717,12 +4911,11 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -4758,7 +4951,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
- check_limit(str, opt);
+ if (!NIL_P(str)) str = check_limit(str, opt);
return date__xmlschema(str);
}
@@ -4776,7 +4969,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
* Related: Date._xmlschema (returns a hash).
@@ -4786,12 +4979,11 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01");
+ str = rb_str_new2(JULIAN_EPOCH_DATE);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -4811,7 +5003,7 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
* Date._rfc2822(string, limit: 128) -> hash
*
* Returns a hash of values parsed from +string+, which should be a valid
- * {RFC 2822 date format}[https://datatracker.ietf.org/doc/html/rfc2822]:
+ * {RFC 2822 date format}[rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
@@ -4820,8 +5012,6 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
*
* See argument {limit}[rdoc-ref:Date@Argument+limit].
*
- * Date._rfc822 is an alias for Date._rfc2822.
- *
* Related: Date.rfc2822 (returns a \Date object).
*/
static VALUE
@@ -4830,7 +5020,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
- check_limit(str, opt);
+ if (!NIL_P(str)) str = check_limit(str, opt);
return date__rfc2822(str);
}
@@ -4841,7 +5031,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
*
* Returns a new \Date object with values parsed from +string+,
* which should be a valid
- * {RFC 2822 date format}[https://datatracker.ietf.org/doc/html/rfc2822]:
+ * {RFC 2822 date format}[rdoc-ref:language/strftime_formatting.rdoc@RFC+2822+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
@@ -4849,11 +5039,9 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
- * Date.rfc822 is an alias for Date.rfc2822.
- *
* Related: Date._rfc2822 (returns a hash).
*/
static VALUE
@@ -4861,11 +5049,11 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("Mon, 1 Jan -4712 00:00:00 +0000");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME_RFC3339);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -4885,7 +5073,7 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
* Date._httpdate(string, limit: 128) -> hash
*
* Returns a hash of values parsed from +string+, which should be a valid
- * HTTP date format:
+ * {HTTP date format}[rdoc-ref:language/strftime_formatting.rdoc@HTTP+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
@@ -4900,7 +5088,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
- check_limit(str, opt);
+ if (!NIL_P(str)) str = check_limit(str, opt);
return date__httpdate(str);
}
@@ -4911,7 +5099,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
*
* Returns a new \Date object with values parsed from +string+,
* which should be a valid
- * {RFC 2616 date format}[https://datatracker.ietf.org/doc/html/rfc2616]:
+ * {HTTP date format}[rdoc-ref:language/strftime_formatting.rdoc@HTTP+Format]:
*
* d = Date.new(2001, 2, 3)
s = d.httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
@@ -4919,7 +5107,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
* Related: Date._httpdate (returns a hash).
@@ -4929,11 +5117,11 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("Mon, 01 Jan -4712 00:00:00 GMT");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME_HTTPDATE);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -4953,7 +5141,7 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass)
* Date._jisx0301(string, limit: 128) -> hash
*
* Returns a hash of values parsed from +string+, which should be a valid
- * JIS X 0301 date format:
+ * {JIS X 0301 date format}[rdoc-ref:language/strftime_formatting.rdoc@JIS+X+0301+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.jisx0301 # => "H13.02.03"
@@ -4969,7 +5157,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
- check_limit(str, opt);
+ if (!NIL_P(str)) str = check_limit(str, opt);
return date__jisx0301(str);
}
@@ -4979,7 +5167,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
* Date.jisx0301(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
*
* Returns a new \Date object with values parsed from +string+,
- * which should be a valid JIS X 0301 format:
+ * which should be a valid {JIS X 0301 format}[rdoc-ref:language/strftime_formatting.rdoc@JIS+X+0301+Format]:
*
* d = Date.new(2001, 2, 3)
* s = d.jisx0301 # => "H13.02.03"
@@ -4991,7 +5179,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
*
* See:
*
- * - Argument {start}[rdoc-ref:Date@Argument+start].
+ * - Argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
*
* Related: Date._jisx0301 (returns a hash).
@@ -5001,12 +5189,11 @@ date_s_jisx0301(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01");
+ str = rb_str_new2(JULIAN_EPOCH_DATE);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -5334,7 +5521,6 @@ d_lite_yday(VALUE self)
*
* Date.new(2001, 2, 3).mon # => 2
*
- * Date#month is an alias for Date#mon.
*/
static VALUE
d_lite_mon(VALUE self)
@@ -5351,7 +5537,6 @@ d_lite_mon(VALUE self)
*
* Date.new(2001, 2, 3).mday # => 3
*
- * Date#day is an alias for Date#mday.
*/
static VALUE
d_lite_mday(VALUE self)
@@ -5601,7 +5786,6 @@ d_lite_hour(VALUE self)
*
* DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5
*
- * Date#minute is an alias for Date#min.
*/
static VALUE
d_lite_min(VALUE self)
@@ -5618,7 +5802,6 @@ d_lite_min(VALUE self)
*
* DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6
*
- * Date#second is an alias for Date#sec.
*/
static VALUE
d_lite_sec(VALUE self)
@@ -5636,7 +5819,6 @@ d_lite_sec(VALUE self)
*
* DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2)
*
- * Date#second_fraction is an alias for Date#sec_fraction.
*/
static VALUE
d_lite_sec_fraction(VALUE self)
@@ -5755,7 +5937,7 @@ d_lite_leap_p(VALUE self)
* Date.new(2001, 2, 3, Date::GREGORIAN).start # => -Infinity
* Date.new(2001, 2, 3, Date::JULIAN).start # => Infinity
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
*/
static VALUE
@@ -5821,7 +6003,7 @@ dup_obj_with_new_start(VALUE obj, double sg)
/*
* call-seq:
- * new_start(start = Date::ITALY]) -> new_date
+ * new_start(start = Date::ITALY) -> new_date
*
* Returns a copy of +self+ with the given +start+ value:
*
@@ -5830,7 +6012,7 @@ dup_obj_with_new_start(VALUE obj, double sg)
* d1 = d0.new_start(Date::JULIAN)
* d1.julian? # => true
*
- * See argument {start}[rdoc-ref:Date@Argument+start].
+ * See argument {start}[rdoc-ref:language/calendars.rdoc@Argument+start].
*
*/
static VALUE
@@ -6335,9 +6517,11 @@ minus_dd(VALUE self, VALUE other)
* call-seq:
* 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, returns a date object
- * pointing +other+ days before self. If the other is a fractional number,
+ * If the other is a date object, returns a Rational
+ * whose value is the difference between the two dates in days.
+ * If the other is a numeric value, returns a date object
+ * pointing +other+ days before self.
+ * If the other is a fractional number,
* assumes its precision is at most nanosecond.
*
* Date.new(2001,2,3) - 1 #=> #<Date: 2001-02-02 ...>
@@ -6412,7 +6596,6 @@ d_lite_prev_day(int argc, VALUE *argv, VALUE self)
* d.to_s # => "2001-02-03"
* d.next.to_s # => "2001-02-04"
*
- * Date#succ is an alias for Date#next.
*/
static VALUE
d_lite_next(VALUE self)
@@ -6945,13 +7128,24 @@ d_lite_eql_p(VALUE self, VALUE other)
static VALUE
d_lite_hash(VALUE self)
{
- st_index_t v, h[4];
+ st_index_t v, h[5];
+ VALUE nth;
get_d1(self);
- h[0] = m_nth(dat);
- h[1] = m_jd(dat);
- h[2] = m_df(dat);
- h[3] = m_sf(dat);
+ nth = m_nth(dat);
+
+ if (FIXNUM_P(nth)) {
+ h[0] = 0;
+ h[1] = (st_index_t)nth;
+ } else {
+ h[0] = 1;
+ h[1] = (st_index_t)FIX2LONG(rb_hash(nth));
+ }
+
+ h[2] = m_jd(dat);
+ h[3] = m_df(dat);
+ h[4] = m_sf(dat);
+
v = rb_memhash(h, sizeof(h));
return ST2FIX(v);
}
@@ -6966,7 +7160,7 @@ static VALUE strftimev(const char *, VALUE,
* to_s -> string
*
* Returns a string representation of the date in +self+
- * in {ISO 8601 extended date format}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html#label-ISO+8601+Format+Specifications]
+ * in {ISO 8601 extended date format}[rdoc-ref:language/strftime_formatting.rdoc@ISO+8601+Format+Specifications]
* (<tt>'%Y-%m-%d'</tt>):
*
* Date.new(2001, 2, 3).to_s # => "2001-02-03"
@@ -7247,7 +7441,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
* Date.new(2001, 2, 3).strftime # => "2001-02-03"
*
* For other formats, see
- * {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html].
+ * {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc].
*
*/
static VALUE
@@ -7279,14 +7473,13 @@ strftimev(const char *fmt, VALUE self,
* asctime -> string
*
* Equivalent to #strftime with argument <tt>'%a %b %e %T %Y'</tt>
- * (or its {shorthand form}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html#label-Shorthand+Conversion+Specifiers]
+ * (or its {shorthand form}[rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifiers]
* <tt>'%c'</tt>):
*
* Date.new(2001, 2, 3).asctime # => "Sat Feb 3 00:00:00 2001"
*
- * See {asctime}[https://linux.die.net/man/3/asctime].
+ * See {asctime}[https://man7.org/linux/man-pages/man3/asctime.3p.html].
*
- * Date#ctime is an alias for Date#asctime.
*/
static VALUE
d_lite_asctime(VALUE self)
@@ -7299,12 +7492,11 @@ d_lite_asctime(VALUE self)
* iso8601 -> string
*
* Equivalent to #strftime with argument <tt>'%Y-%m-%d'</tt>
- * (or its {shorthand form}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html#label-Shorthand+Conversion+Specifiers]
+ * (or its {shorthand form}[rdoc-ref:language/strftime_formatting.rdoc@Shorthand+Conversion+Specifiers]
* <tt>'%F'</tt>);
*
* Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
*
- * Date#xmlschema is an alias for Date#iso8601.
*/
static VALUE
d_lite_iso8601(VALUE self)
@@ -7317,7 +7509,7 @@ d_lite_iso8601(VALUE self)
* rfc3339 -> string
*
* Equivalent to #strftime with argument <tt>'%FT%T%:z'</tt>;
- * see {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html]:
+ * see {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc]:
*
* Date.new(2001, 2, 3).rfc3339 # => "2001-02-03T00:00:00+00:00"
*
@@ -7333,11 +7525,10 @@ d_lite_rfc3339(VALUE self)
* rfc2822 -> string
*
* Equivalent to #strftime with argument <tt>'%a, %-d %b %Y %T %z'</tt>;
- * see {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html]:
+ * see {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc]:
*
* Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
*
- * Date#rfc822 is an alias for Date#rfc2822.
*/
static VALUE
d_lite_rfc2822(VALUE self)
@@ -7350,7 +7541,7 @@ d_lite_rfc2822(VALUE self)
* httpdate -> string
*
* Equivalent to #strftime with argument <tt>'%a, %d %b %Y %T GMT'</tt>;
- * see {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html]:
+ * see {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc]:
*
* Date.new(2001, 2, 3).httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT"
*
@@ -7425,6 +7616,96 @@ d_lite_jisx0301(VALUE self)
return strftimev(fmt, self, set_tmx);
}
+static VALUE
+deconstruct_keys(VALUE self, VALUE keys, int is_datetime)
+{
+ VALUE h = rb_hash_new();
+ long i;
+
+ get_d1(self);
+
+ if (NIL_P(keys)) {
+ rb_hash_aset(h, sym_year, m_real_year(dat));
+ rb_hash_aset(h, sym_month, INT2FIX(m_mon(dat)));
+ rb_hash_aset(h, sym_day, INT2FIX(m_mday(dat)));
+ rb_hash_aset(h, sym_yday, INT2FIX(m_yday(dat)));
+ rb_hash_aset(h, sym_wday, INT2FIX(m_wday(dat)));
+ if (is_datetime) {
+ rb_hash_aset(h, sym_hour, INT2FIX(m_hour(dat)));
+ rb_hash_aset(h, sym_min, INT2FIX(m_min(dat)));
+ rb_hash_aset(h, sym_sec, INT2FIX(m_sec(dat)));
+ rb_hash_aset(h, sym_sec_fraction, m_sf_in_sec(dat));
+ rb_hash_aset(h, sym_zone, m_zone(dat));
+ }
+
+ return h;
+ }
+ if (!RB_TYPE_P(keys, T_ARRAY)) {
+ rb_raise(rb_eTypeError,
+ "wrong argument type %"PRIsVALUE" (expected Array or nil)",
+ rb_obj_class(keys));
+
+ }
+
+ for (i=0; i<RARRAY_LEN(keys); i++) {
+ VALUE key = RARRAY_AREF(keys, i);
+
+ if (sym_year == key) rb_hash_aset(h, key, m_real_year(dat));
+ if (sym_month == key) rb_hash_aset(h, key, INT2FIX(m_mon(dat)));
+ if (sym_day == key) rb_hash_aset(h, key, INT2FIX(m_mday(dat)));
+ if (sym_yday == key) rb_hash_aset(h, key, INT2FIX(m_yday(dat)));
+ if (sym_wday == key) rb_hash_aset(h, key, INT2FIX(m_wday(dat)));
+ if (is_datetime) {
+ if (sym_hour == key) rb_hash_aset(h, key, INT2FIX(m_hour(dat)));
+ if (sym_min == key) rb_hash_aset(h, key, INT2FIX(m_min(dat)));
+ if (sym_sec == key) rb_hash_aset(h, key, INT2FIX(m_sec(dat)));
+ if (sym_sec_fraction == key) rb_hash_aset(h, key, m_sf_in_sec(dat));
+ if (sym_zone == key) rb_hash_aset(h, key, m_zone(dat));
+ }
+ }
+ return h;
+}
+
+/*
+ * call-seq:
+ * deconstruct_keys(array_of_names_or_nil) -> hash
+ *
+ * Returns a hash of the name/value pairs, to use in pattern matching.
+ * Possible keys are: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>,
+ * <tt>:wday</tt>, <tt>:yday</tt>.
+ *
+ * Possible usages:
+ *
+ * d = Date.new(2022, 10, 5)
+ *
+ * if d in wday: 3, day: ..7 # uses deconstruct_keys underneath
+ * puts "first Wednesday of the month"
+ * end
+ * #=> prints "first Wednesday of the month"
+ *
+ * case d
+ * in year: ...2022
+ * puts "too old"
+ * in month: ..9
+ * puts "quarter 1-3"
+ * in wday: 1..5, month:
+ * puts "working day in month #{month}"
+ * end
+ * #=> prints "working day in month 10"
+ *
+ * Note that deconstruction by pattern can also be combined with class check:
+ *
+ * if d in Date(wday: 3, day: ..7)
+ * puts "first Wednesday of the month"
+ * end
+ *
+ */
+static VALUE
+d_lite_deconstruct_keys(VALUE self, VALUE keys)
+{
+ return deconstruct_keys(self, keys, /* is_datetime=false */ 0);
+}
+
#ifndef NDEBUG
/* :nodoc: */
static VALUE
@@ -7439,10 +7720,7 @@ d_lite_marshal_dump_old(VALUE self)
m_of_in_day(dat),
DBL2NUM(m_sg(dat)));
- if (FL_TEST(self, FL_EXIVAR)) {
- rb_copy_generic_ivar(a, self);
- FL_SET(a, FL_EXIVAR);
- }
+ rb_copy_generic_ivar(a, self);
return a;
}
@@ -7464,10 +7742,8 @@ d_lite_marshal_dump(VALUE self)
INT2FIX(m_of(dat)),
DBL2NUM(m_sg(dat)));
- if (FL_TEST(self, FL_EXIVAR)) {
- rb_copy_generic_ivar(a, self);
- FL_SET(a, FL_EXIVAR);
- }
+
+ rb_copy_generic_ivar(a, self);
return a;
}
@@ -7540,10 +7816,7 @@ d_lite_marshal_load(VALUE self, VALUE a)
HAVE_JD | HAVE_DF);
}
- if (FL_TEST(a, FL_EXIVAR)) {
- rb_copy_generic_ivar(self, a);
- FL_SET(self, FL_EXIVAR);
- }
+ rb_copy_generic_ivar(self, a);
return self;
}
@@ -8296,7 +8569,7 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
fmt = rb_str_new2("%FT%T%z");
case 2:
@@ -8344,12 +8617,11 @@ datetime_s_parse(int argc, VALUE *argv, VALUE klass)
{
VALUE str, comp, sg, opt;
- rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "03:", &str, &comp, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
comp = Qtrue;
case 2:
@@ -8391,12 +8663,11 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -8406,7 +8677,7 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
VALUE argv2[2], hash;
argv2[0] = str;
argv2[1] = opt;
- if (!NIL_P(opt)) argc2--;
+ if (!NIL_P(opt)) argc2++;
hash = date_s__iso8601(argc2, argv2, klass);
return dt_new_by_frags(klass, hash, sg);
}
@@ -8431,12 +8702,11 @@ datetime_s_rfc3339(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -8471,12 +8741,11 @@ datetime_s_xmlschema(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -8512,12 +8781,11 @@ datetime_s_rfc2822(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("Mon, 1 Jan -4712 00:00:00 +0000");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME_RFC3339);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -8552,12 +8820,11 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("Mon, 01 Jan -4712 00:00:00 GMT");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME_HTTPDATE);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -8597,12 +8864,11 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
{
VALUE str, sg, opt;
- rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
- if (!NIL_P(opt)) argc--;
+ argc = rb_scan_args(argc, argv, "02:", &str, &sg, &opt);
switch (argc) {
case 0:
- str = rb_str_new2("-4712-01-01T00:00:00+00:00");
+ str = rb_str_new2(JULIAN_EPOCH_DATETIME);
case 1:
sg = INT2FIX(DEFAULT_SG);
}
@@ -8643,8 +8909,8 @@ dt_lite_to_s(VALUE self)
*
* DateTime.now.strftime # => "2022-07-01T11:03:19-05:00"
*
- * For other formats, see
- * {Formats for Dates and Times}[doc/strftime_formatting.rdoc].
+ * For other formats,
+ * see {Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc]:
*
*/
static VALUE
@@ -8733,6 +8999,47 @@ dt_lite_jisx0301(int argc, VALUE *argv, VALUE self)
iso8601_timediv(self, n));
}
+/*
+ * call-seq:
+ * deconstruct_keys(array_of_names_or_nil) -> hash
+ *
+ * Returns a hash of the name/value pairs, to use in pattern matching.
+ * Possible keys are: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>,
+ * <tt>:wday</tt>, <tt>:yday</tt>, <tt>:hour</tt>, <tt>:min</tt>,
+ * <tt>:sec</tt>, <tt>:sec_fraction</tt>, <tt>:zone</tt>.
+ *
+ * Possible usages:
+ *
+ * dt = DateTime.new(2022, 10, 5, 13, 30)
+ *
+ * if d in wday: 1..5, hour: 10..18 # uses deconstruct_keys underneath
+ * puts "Working time"
+ * end
+ * #=> prints "Working time"
+ *
+ * case dt
+ * in year: ...2022
+ * puts "too old"
+ * in month: ..9
+ * puts "quarter 1-3"
+ * in wday: 1..5, month:
+ * puts "working day in month #{month}"
+ * end
+ * #=> prints "working day in month 10"
+ *
+ * Note that deconstruction by pattern can also be combined with class check:
+ *
+ * if d in DateTime(wday: 1..5, hour: 10..18, day: ..7)
+ * puts "Working time, first week of the month"
+ * end
+ *
+ */
+static VALUE
+dt_lite_deconstruct_keys(VALUE self, VALUE keys)
+{
+ return deconstruct_keys(self, keys, /* is_datetime=true */ 1);
+}
+
/* conversions */
#define f_subsec(x) rb_funcall(x, rb_intern("subsec"), 0)
@@ -8811,7 +9118,7 @@ time_to_datetime(VALUE self)
ret = d_complex_new_internal(cDateTime,
nth, 0,
0, sf,
- of, DEFAULT_SG,
+ of, GREGORIAN,
ry, m, d,
h, min, s,
HAVE_CIVIL | HAVE_TIME);
@@ -8837,18 +9144,23 @@ time_to_datetime(VALUE self)
static VALUE
date_to_time(VALUE self)
{
+ VALUE t;
+
get_d1a(self);
if (m_julian_p(adat)) {
- VALUE tmp = d_lite_gregorian(self);
- get_d1b(tmp);
+ VALUE g = d_lite_gregorian(self);
+ get_d1b(g);
adat = bdat;
+ self = g;
}
- return f_local3(rb_cTime,
+ t = f_local3(rb_cTime,
m_real_year(adat),
INT2FIX(m_mon(adat)),
INT2FIX(m_mday(adat)));
+ RB_GC_GUARD(self); /* may be the converted gregorian */
+ return t;
}
/*
@@ -8915,12 +9227,18 @@ date_to_datetime(VALUE self)
static VALUE
datetime_to_time(VALUE self)
{
- volatile VALUE dup = dup_obj(self);
+ get_d1(self);
+
+ if (m_julian_p(dat)) {
+ VALUE g = d_lite_gregorian(self);
+ get_d1a(g);
+ dat = adat;
+ self = g;
+ }
+
{
VALUE t;
- get_d1(dup);
-
t = rb_funcall(rb_cTime,
rb_intern("new"),
7,
@@ -8932,6 +9250,7 @@ datetime_to_time(VALUE self)
f_add(INT2FIX(m_sec(dat)),
m_sf_in_sec(dat)),
INT2FIX(m_of(dat)));
+ RB_GC_GUARD(self); /* may be the converted gregorian */
return t;
}
}
@@ -9336,7 +9655,7 @@ mk_ary_of_str(long len, const char *a[])
}
rb_ary_push(o, e);
}
- rb_obj_freeze(o);
+ rb_ary_freeze(o);
return o;
}
@@ -9358,7 +9677,19 @@ Init_date_core(void)
id_ge_p = rb_intern_const(">=");
id_eqeq_p = rb_intern_const("==");
+ sym_year = ID2SYM(rb_intern_const("year"));
+ sym_month = ID2SYM(rb_intern_const("month"));
+ sym_yday = ID2SYM(rb_intern_const("yday"));
+ sym_wday = ID2SYM(rb_intern_const("wday"));
+ sym_day = ID2SYM(rb_intern_const("day"));
+ sym_hour = ID2SYM(rb_intern_const("hour"));
+ sym_min = ID2SYM(rb_intern_const("min"));
+ sym_sec = ID2SYM(rb_intern_const("sec"));
+ sym_sec_fraction = ID2SYM(rb_intern_const("sec_fraction"));
+ sym_zone = ID2SYM(rb_intern_const("zone"));
+
half_days_in_day = rb_rational_new2(INT2FIX(1), INT2FIX(2));
+ rb_gc_register_mark_object(half_days_in_day);
#if (LONG_MAX / DAY_IN_SECONDS) > SECOND_IN_NANOSECONDS
day_in_nanoseconds = LONG2NUM((long)DAY_IN_SECONDS *
@@ -9370,207 +9701,71 @@ Init_date_core(void)
day_in_nanoseconds = f_mul(INT2FIX(DAY_IN_SECONDS),
INT2FIX(SECOND_IN_NANOSECONDS));
#endif
-
- rb_gc_register_mark_object(half_days_in_day);
rb_gc_register_mark_object(day_in_nanoseconds);
positive_inf = +INFINITY;
negative_inf = -INFINITY;
/*
- * date and datetime class - Tadayoshi Funaba 1998-2011
- *
- * 'date' provides two classes: Date and DateTime.
- *
- * == Terms and Definitions
- *
- * Some terms and definitions are based on ISO 8601 and JIS X 0301.
- *
- * === Calendar Date
- *
- * The calendar date is a particular day of a calendar year,
- * identified by its ordinal number within a calendar month within
- * that year.
- *
- * In those classes, this is so-called "civil".
- *
- * === Ordinal Date
- *
- * The ordinal date is a particular day of a calendar year identified
- * by its ordinal number within the year.
+ * \Class \Date provides methods for storing and manipulating
+ * calendar dates.
*
- * In those classes, this is so-called "ordinal".
+ * Consider using
+ * {class Time}[rdoc-ref:Time]
+ * instead of class \Date if:
*
- * === Week Date
+ * - You need both dates and times; \Date handles only dates.
+ * - You need only Gregorian dates (and not Julian dates);
+ * see {Julian and Gregorian Calendars}[rdoc-ref:language/calendars.rdoc].
*
- * The week date is a date identified by calendar week and day numbers.
+ * A \Date object, once created, is immutable, and cannot be modified.
*
- * The calendar week is a seven day period within a calendar year,
- * starting on a Monday and identified by its ordinal number within
- * the year; the first calendar week of the year is the one that
- * includes the first Thursday of that year. In the Gregorian
- * calendar, this is equivalent to the week which includes January 4.
+ * == Creating a \Date
*
- * In those classes, this is so-called "commercial".
+ * You can create a date for the current date, using Date.today:
*
- * === Julian Day Number
+ * Date.today # => #<Date: 1999-12-31>
*
- * The Julian day number is in elapsed days since noon (Greenwich Mean
- * Time) on January 1, 4713 BCE (in the Julian calendar).
+ * You can create a specific date from various combinations of arguments:
*
- * In this document, the astronomical Julian day number is the same as
- * the original Julian day number. And the chronological Julian day
- * number is a variation of the Julian day number. Its days begin at
- * midnight on local time.
+ * - Date.new takes integer year, month, and day-of-month:
*
- * In this document, when the term "Julian day number" simply appears,
- * it just refers to "chronological Julian day number", not the
- * original.
+ * Date.new(1999, 12, 31) # => #<Date: 1999-12-31>
*
- * In those classes, those are so-called "ajd" and "jd".
+ * - Date.ordinal takes integer year and day-of-year:
*
- * === Modified Julian Day Number
+ * Date.ordinal(1999, 365) # => #<Date: 1999-12-31>
*
- * The modified Julian day number is in elapsed days since midnight
- * (Coordinated Universal Time) on November 17, 1858 CE (in the
- * Gregorian calendar).
+ * - Date.jd takes integer Julian day:
*
- * In this document, the astronomical modified Julian day number is
- * the same as the original modified Julian day number. And the
- * chronological modified Julian day number is a variation of the
- * modified Julian day number. Its days begin at midnight on local
- * time.
+ * Date.jd(2451544) # => #<Date: 1999-12-31>
*
- * In this document, when the term "modified Julian day number" simply
- * appears, it just refers to "chronological modified Julian day
- * number", not the original.
+ * - Date.commercial takes integer commercial data (year, week, day-of-week):
*
- * In those classes, those are so-called "amjd" and "mjd".
+ * Date.commercial(1999, 52, 5) # => #<Date: 1999-12-31>
*
- * == Date
+ * - Date.parse takes a string, which it parses heuristically:
*
- * A subclass of Object that includes the Comparable module and
- * easily handles date.
+ * Date.parse('1999-12-31') # => #<Date: 1999-12-31>
+ * Date.parse('31-12-1999') # => #<Date: 1999-12-31>
+ * Date.parse('1999-365') # => #<Date: 1999-12-31>
+ * Date.parse('1999-W52-5') # => #<Date: 1999-12-31>
*
- * A Date object is created with Date::new, Date::jd, Date::ordinal,
- * Date::commercial, Date::parse, Date::strptime, Date::today,
- * Time#to_date, etc.
+ * - Date.strptime takes a date string and a format string,
+ * then parses the date string according to the format string:
*
- * require 'date'
- *
- * Date.new(2001,2,3)
- * #=> #<Date: 2001-02-03 ...>
- * Date.jd(2451944)
- * #=> #<Date: 2001-02-03 ...>
- * Date.ordinal(2001,34)
- * #=> #<Date: 2001-02-03 ...>
- * Date.commercial(2001,5,6)
- * #=> #<Date: 2001-02-03 ...>
- * Date.parse('2001-02-03')
- * #=> #<Date: 2001-02-03 ...>
- * Date.strptime('03-02-2001', '%d-%m-%Y')
- * #=> #<Date: 2001-02-03 ...>
- * Time.new(2001,2,3).to_date
- * #=> #<Date: 2001-02-03 ...>
- *
- * All date objects are immutable; hence cannot modify themselves.
- *
- * The concept of a date object can be represented as a tuple
- * of the day count, the offset and the day of calendar reform.
- *
- * The day count denotes the absolute position of a temporal
- * dimension. The offset is relative adjustment, which determines
- * decoded local time with the day count. The day of calendar
- * reform denotes the start day of the new style. The old style
- * of the West is the Julian calendar which was adopted by
- * Caesar. The new style is the Gregorian calendar, which is the
- * current civil calendar of many countries.
- *
- * The day count is virtually the astronomical Julian day number.
- * The offset in this class is usually zero, and cannot be
- * specified directly.
- *
- * A Date object can be created with an optional argument,
- * the day of calendar reform as a Julian day number, which
- * should be 2298874 to 2426355 or negative/positive infinity.
- * The default value is +Date::ITALY+ (2299161=1582-10-15).
- * See also sample/cal.rb.
- *
- * $ ruby sample/cal.rb -c it 10 1582
- * October 1582
- * S M Tu W Th F S
- * 1 2 3 4 15 16
- * 17 18 19 20 21 22 23
- * 24 25 26 27 28 29 30
- * 31
- *
- * $ ruby sample/cal.rb -c gb 9 1752
- * September 1752
- * S M Tu W Th F S
- * 1 2 14 15 16
- * 17 18 19 20 21 22 23
- * 24 25 26 27 28 29 30
- *
- * A Date object has various methods. See each reference.
- *
- * d = Date.parse('3rd Feb 2001')
- * #=> #<Date: 2001-02-03 ...>
- * d.year #=> 2001
- * d.mon #=> 2
- * d.mday #=> 3
- * d.wday #=> 6
- * d += 1 #=> #<Date: 2001-02-04 ...>
- * d.strftime('%a %d %b %Y') #=> "Sun 04 Feb 2001"
- *
- * === Argument +start+
+ * Date.strptime('1999-12-31', '%Y-%m-%d') # => #<Date: 1999-12-31>
+ * Date.strptime('31-12-1999', '%d-%m-%Y') # => #<Date: 1999-12-31>
+ * Date.strptime('1999-365', '%Y-%j') # => #<Date: 1999-12-31>
+ * Date.strptime('1999-W52-5', '%G-W%V-%u') # => #<Date: 1999-12-31>
+ * Date.strptime('1999 52 5', '%Y %U %w') # => #<Date: 1999-12-31>
+ * Date.strptime('1999 52 5', '%Y %W %u') # => #<Date: 1999-12-31>
+ * Date.strptime('fri31dec99', '%a%d%b%y') # => #<Date: 1999-12-31>
*
- * Certain calculations and comparisons for a \Date object
- * are affected by what the object considers to have been
- * the changeover date from the
- * {Julian}[https://en.wikipedia.org/wiki/Julian_calendar] to the
- * {Gregorian}[https://en.wikipedia.org/wiki/Gregorian_calendar]
- * calendar;
- * this is set by argument +start+ when the object is created:
+ * See also the specialized methods in
+ * {"Specialized Format Strings" in Formats for Dates and Times}[rdoc-ref:language/strftime_formatting.rdoc@Specialized+Format+Strings]
*
- * - Dates before the changeover are considered to be Julian.
- * - Dates after the changeover are considered to be Gregorian.
- *
- * The value of the +start+ argument may be:
- *
- * - Date::ITALY (the default) - the changeover date is October 10, 1582:
- *
- * Date::ITALY # => 2299161
- * Date.jd(Date::ITALY).to_s # => "1582-10-15"
- *
- * # Julian base date, Julian result date.
- * (Date.new(1581, 1, 1, Date::ITALY) + 365).to_s # => "1582-01-01"
- * # Gregorian base date, Gregorian result date.
- * (Date.new(1583, 1, 1, Date::ITALY) + 365).to_s # => "1584-01-01"
- *
- * # Julian base date, Gregorian result date.
- * (Date.new(1582, 1, 1, Date::ITALY) + 365).to_s # => "1583-01-11"
- * # Gregorian base date, Julian result date.
- * (Date.new(1583, 1, 1, Date::ITALY) - 365).to_s # => "1581-12-22"
- *
- * - Date::ENGLAND - the changeover date is September 9, 1752:
- *
- * Date::ENGLAND # => 2361222
- * Date.jd(Date::ENGLAND).to_s # => "1752-09-14"
- *
- * # Julian base date, Julian result date.
- * (Date.new(1751, 1, 1, Date::ENGLAND) + 365).to_s # => "1752-01-01"
- * # Gregorian base date, Gregorian result date.
- * (Date.new(1753, 1, 1, Date::ENGLAND) + 365).to_s # => "1754-01-01"
- *
- * # Julian base date, Gregorian result date.
- * (Date.new(1752, 1, 1, Date::ENGLAND) + 365).to_s # => "1753-01-11"
- * # Gregorian base date, Julian result date.
- * (Date.new(1753, 1, 1, Date::ENGLAND) - 365).to_s # => "1751-12-22"
- *
- * - Date::JULIAN - no changeover date; all dates are Julian.
- * - Date::GREGORIAN - no changeover date; all dates are Gregorian.
- *
- * === Argument +limit+
+ * == Argument +limit+
*
* Certain singleton methods in \Date that parse string arguments
* also take optional keyword argument +limit+,
@@ -9813,6 +10008,8 @@ Init_date_core(void)
rb_define_method(cDate, "httpdate", d_lite_httpdate, 0);
rb_define_method(cDate, "jisx0301", d_lite_jisx0301, 0);
+ rb_define_method(cDate, "deconstruct_keys", d_lite_deconstruct_keys, 1);
+
#ifndef NDEBUG
rb_define_method(cDate, "marshal_dump_old", d_lite_marshal_dump_old, 0);
#endif
@@ -10023,6 +10220,8 @@ Init_date_core(void)
rb_define_method(cDateTime, "rfc3339", dt_lite_rfc3339, -1);
rb_define_method(cDateTime, "jisx0301", dt_lite_jisx0301, -1);
+ rb_define_method(cDateTime, "deconstruct_keys", dt_lite_deconstruct_keys, 1);
+
/* conversions */
rb_define_method(rb_cTime, "to_time", time_to_time, 0);
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 95274d5baa..a1600e4708 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -7,6 +7,9 @@
#include "ruby/re.h"
#include <ctype.h>
+#undef strncasecmp
+#define strncasecmp STRNCASECMP
+
RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y);
RUBY_EXTERN unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
@@ -413,7 +416,6 @@ VALUE
date_zone_to_diff(VALUE str)
{
VALUE offset = Qnil;
- VALUE vbuf = 0;
long l = RSTRING_LEN(str);
const char *s = RSTRING_PTR(str);
@@ -439,16 +441,26 @@ date_zone_to_diff(VALUE str)
l -= w;
dst = 1;
}
+
{
+ const char *zn = s;
long sl = shrunk_size(s, l);
+ char shrunk_buff[MAX_WORD_LENGTH]; /* no terminator to be added */
+ const struct zone *z = 0;
+
+ if (sl <= 0) {
+ sl = l;
+ }
+ else if (sl <= MAX_WORD_LENGTH) {
+ char *d = shrunk_buff;
+ sl = shrink_space(d, s, l);
+ zn = d;
+ }
+
if (sl > 0 && sl <= MAX_WORD_LENGTH) {
- char *d = ALLOCV_N(char, vbuf, sl);
- l = shrink_space(d, s, l);
- s = d;
+ z = zonetab(zn, (unsigned int)sl);
}
- }
- if (l > 0 && l <= MAX_WORD_LENGTH) {
- const struct zone *z = zonetab(s, (unsigned int)l);
+
if (z) {
int d = z->offset;
if (dst)
@@ -457,6 +469,7 @@ date_zone_to_diff(VALUE str)
goto ok;
}
}
+
{
char *p;
int sign = 0;
@@ -473,27 +486,53 @@ date_zone_to_diff(VALUE str)
s++;
l--;
+#define out_of_range(v, min, max) ((v) < (min) || (max) < (v))
hour = STRTOUL(s, &p, 10);
if (*p == ':') {
+ if (out_of_range(hour, 0, 23)) return Qnil;
s = ++p;
min = STRTOUL(s, &p, 10);
+ if (out_of_range(min, 0, 59)) return Qnil;
if (*p == ':') {
s = ++p;
sec = STRTOUL(s, &p, 10);
+ if (out_of_range(sec, 0, 59)) return Qnil;
}
- goto num;
}
- if (*p == ',' || *p == '.') {
- char *e = 0;
- p++;
- min = STRTOUL(p, &e, 10) * 3600;
+ else if (*p == ',' || *p == '.') {
+ /* fractional hour */
+ size_t n;
+ int ov;
+ /* no over precision for offset; 10**-7 hour = 0.36
+ * milliseconds should be enough. */
+ const size_t max_digits = 7; /* 36 * 10**7 < 32-bit FIXNUM_MAX */
+
+ if (out_of_range(hour, 0, 23)) return Qnil;
+
+ n = (s + l) - ++p;
+ if (n > max_digits) n = max_digits;
+ sec = ruby_scan_digits(p, n, 10, &n, &ov);
+ if ((p += n) < s + l && *p >= ('5' + !(sec & 1)) && *p <= '9') {
+ /* round half to even */
+ sec++;
+ }
+ sec *= 36;
if (sign) {
hour = -hour;
- min = -min;
+ sec = -sec;
+ }
+ if (n <= 2) {
+ /* HH.nn or HH.n */
+ if (n == 1) sec *= 10;
+ offset = INT2FIX(sec + hour * 3600);
+ }
+ else {
+ VALUE denom = rb_int_positive_pow(10, (int)(n - 2));
+ offset = f_add(rb_rational_new(INT2FIX(sec), denom), INT2FIX(hour * 3600));
+ if (rb_rational_den(offset) == INT2FIX(1)) {
+ offset = rb_rational_num(offset);
+ }
}
- offset = rb_rational_new(INT2FIX(min),
- rb_int_positive_pow(10, (int)(e - p)));
- offset = f_add(INT2FIX(hour * 3600), offset);
goto ok;
}
else if (l > 2) {
@@ -506,18 +545,16 @@ date_zone_to_diff(VALUE str)
min = ruby_scan_digits(&s[2 - l % 2], 2, 10, &n, &ov);
if (l >= 5)
sec = ruby_scan_digits(&s[4 - l % 2], 2, 10, &n, &ov);
- goto num;
}
- num:
sec += min * 60 + hour * 3600;
if (sign) sec = -sec;
offset = INT2FIX(sec);
+#undef out_of_range
}
}
}
RB_GC_GUARD(str);
ok:
- ALLOCV_END(vbuf);
return offset;
}
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index 7b06a31471..1dde5fa3ec 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -7,31 +7,21 @@
#include "ruby/re.h"
#include <ctype.h>
+#undef strncasecmp
+#define strncasecmp STRNCASECMP
+
static const char *day_names[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday",
- "Sun", "Mon", "Tue", "Wed",
- "Thu", "Fri", "Sat"
};
+static const int ABBREVIATED_DAY_NAME_LENGTH = 3;
static const char *month_names[] = {
"January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December",
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-
-static const char *merid_names[] = {
- "am", "pm",
- "a.m.", "p.m."
-};
-
-static const char *extz_pats[] = {
- ":z",
- "::z",
- ":::z"
};
+static const int ABBREVIATED_MONTH_NAME_LENGTH = 3;
#define sizeof_array(o) (sizeof o / sizeof o[0])
@@ -75,7 +65,7 @@ num_pattern_p(const char *s)
#define NUM_PATTERN_P() num_pattern_p(&fmt[fi + 1])
static long
-read_digits(const char *s, VALUE *n, size_t width)
+read_digits(const char *s, size_t slen, VALUE *n, size_t width)
{
size_t l;
@@ -83,7 +73,7 @@ read_digits(const char *s, VALUE *n, size_t width)
return 0;
l = 0;
- while (ISDIGIT(s[l])) {
+ while (l < slen && ISDIGIT(s[l])) {
if (++l == width) break;
}
@@ -131,9 +121,10 @@ do { \
#define READ_DIGITS(n,w) \
do { \
size_t l; \
- l = read_digits(&str[si], &n, w); \
- if (l == 0) \
+ l = read_digits(&str[si], slen - si, &n, w); \
+ if (l == 0) { \
fail(); \
+ } \
si += l; \
} while (0)
@@ -161,6 +152,12 @@ do { \
VALUE date_zone_to_diff(VALUE);
+static inline int
+head_match_p(size_t len, const char *name, const char *str, size_t slen, size_t si)
+{
+ return slen - si >= len && strncasecmp(name, &str[si], len) == 0;
+}
+
static size_t
date__strptime_internal(const char *str, size_t slen,
const char *fmt, size_t flen, VALUE hash)
@@ -168,9 +165,18 @@ date__strptime_internal(const char *str, size_t slen,
size_t si, fi;
int c;
+#define HEAD_MATCH_P(len, name) head_match_p(len, name, str, slen, si)
si = fi = 0;
while (fi < flen) {
+ if (isspace((unsigned char)fmt[fi])) {
+ while (si < slen && isspace((unsigned char)str[si]))
+ si++;
+ while (++fi < flen && isspace((unsigned char)fmt[fi]));
+ continue;
+ }
+
+ if (si >= slen) fail();
switch (fmt[fi]) {
case '%':
@@ -194,12 +200,11 @@ date__strptime_internal(const char *str, size_t slen,
{
int i;
- for (i = 0; i < (int)sizeof_array(extz_pats); i++)
- if (strncmp(extz_pats[i], &fmt[fi],
- strlen(extz_pats[i])) == 0) {
- fi += i;
- goto again;
- }
+ for (i = 1; i < 3 && fi + i < flen && fmt[fi+i] == ':'; ++i);
+ if (fmt[fi+i] == 'z') {
+ fi += i - 1;
+ goto again;
+ }
fail();
}
@@ -209,10 +214,12 @@ date__strptime_internal(const char *str, size_t slen,
int i;
for (i = 0; i < (int)sizeof_array(day_names); i++) {
- size_t l = strlen(day_names[i]);
- if (strncasecmp(day_names[i], &str[si], l) == 0) {
+ const char *day_name = day_names[i];
+ size_t l = strlen(day_name);
+ if (HEAD_MATCH_P(l, day_name) ||
+ HEAD_MATCH_P(l = ABBREVIATED_DAY_NAME_LENGTH, day_name)) {
si += l;
- set_hash("wday", INT2FIX(i % 7));
+ set_hash("wday", INT2FIX(i));
goto matched;
}
}
@@ -225,10 +232,12 @@ date__strptime_internal(const char *str, size_t slen,
int i;
for (i = 0; i < (int)sizeof_array(month_names); i++) {
- size_t l = strlen(month_names[i]);
- if (strncasecmp(month_names[i], &str[si], l) == 0) {
+ const char *month_name = month_names[i];
+ size_t l = strlen(month_name);
+ if (HEAD_MATCH_P(l, month_name) ||
+ HEAD_MATCH_P(l = ABBREVIATED_MONTH_NAME_LENGTH, month_name)) {
si += l;
- set_hash("mon", INT2FIX((i % 12) + 1));
+ set_hash("mon", INT2FIX(i + 1));
goto matched;
}
}
@@ -402,18 +411,19 @@ date__strptime_internal(const char *str, size_t slen,
case 'P':
case 'p':
+ if (slen - si < 2) fail();
{
- int i;
-
- for (i = 0; i < 4; i++) {
- size_t l = strlen(merid_names[i]);
- if (strncasecmp(merid_names[i], &str[si], l) == 0) {
- si += l;
- set_hash("_merid", INT2FIX((i % 2) == 0 ? 0 : 12));
- goto matched;
- }
+ char c = str[si];
+ const int hour = (c == 'P' || c == 'p') ? 12 : 0;
+ if (!hour && !(c == 'A' || c == 'a')) fail();
+ if ((c = str[si+1]) == '.') {
+ if (slen - si < 4 || str[si+3] != '.') fail();
+ c = str[si += 2];
}
- fail();
+ if (!(c == 'M' || c == 'm')) fail();
+ si += 2;
+ set_hash("_merid", INT2FIX(hour));
+ goto matched;
}
case 'Q':
@@ -587,7 +597,7 @@ date__strptime_internal(const char *str, size_t slen,
b = rb_backref_get();
rb_match_busy(b);
- m = f_match(pat, rb_usascii_str_new2(&str[si]));
+ m = f_match(pat, rb_usascii_str_new(&str[si], slen - si));
if (!NIL_P(m)) {
VALUE s, l, o;
@@ -619,22 +629,13 @@ date__strptime_internal(const char *str, size_t slen,
if (str[si] != '%')
fail();
si++;
- if (fi < flen)
- if (str[si] != fmt[fi])
+ if (fi < flen) {
+ if (si >= slen || str[si] != fmt[fi])
fail();
- si++;
+ si++;
+ }
goto matched;
}
- case ' ':
- case '\t':
- case '\n':
- case '\v':
- case '\f':
- case '\r':
- while (isspace((unsigned char)str[si]))
- si++;
- fi++;
- break;
default:
ordinal:
if (str[si] != fmt[fi])
@@ -660,6 +661,9 @@ date__strptime(const char *str, size_t slen,
si = date__strptime_internal(str, slen, fmt, flen, hash);
+ if (fail_p())
+ return Qnil;
+
if (slen > si) {
VALUE s;
@@ -667,9 +671,6 @@ date__strptime(const char *str, size_t slen,
set_hash("leftover", s);
}
- if (fail_p())
- return Qnil;
-
cent = del_hash("_cent");
if (!NIL_P(cent)) {
VALUE year;
diff --git a/ext/date/depend b/ext/date/depend
index 3f550cd0a7..4fb78149a1 100644
--- a/ext/date/depend
+++ b/ext/date/depend
@@ -53,6 +53,7 @@ date_core.o: $(hdrdir)/ruby/internal/attr/noexcept.h
date_core.o: $(hdrdir)/ruby/internal/attr/noinline.h
date_core.o: $(hdrdir)/ruby/internal/attr/nonnull.h
date_core.o: $(hdrdir)/ruby/internal/attr/noreturn.h
+date_core.o: $(hdrdir)/ruby/internal/attr/packed_struct.h
date_core.o: $(hdrdir)/ruby/internal/attr/pure.h
date_core.o: $(hdrdir)/ruby/internal/attr/restrict.h
date_core.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h
@@ -121,7 +122,6 @@ date_core.o: $(hdrdir)/ruby/internal/intern/enumerator.h
date_core.o: $(hdrdir)/ruby/internal/intern/error.h
date_core.o: $(hdrdir)/ruby/internal/intern/eval.h
date_core.o: $(hdrdir)/ruby/internal/intern/file.h
-date_core.o: $(hdrdir)/ruby/internal/intern/gc.h
date_core.o: $(hdrdir)/ruby/internal/intern/hash.h
date_core.o: $(hdrdir)/ruby/internal/intern/io.h
date_core.o: $(hdrdir)/ruby/internal/intern/load.h
@@ -138,6 +138,7 @@ date_core.o: $(hdrdir)/ruby/internal/intern/re.h
date_core.o: $(hdrdir)/ruby/internal/intern/ruby.h
date_core.o: $(hdrdir)/ruby/internal/intern/select.h
date_core.o: $(hdrdir)/ruby/internal/intern/select/largesize.h
+date_core.o: $(hdrdir)/ruby/internal/intern/set.h
date_core.o: $(hdrdir)/ruby/internal/intern/signal.h
date_core.o: $(hdrdir)/ruby/internal/intern/sprintf.h
date_core.o: $(hdrdir)/ruby/internal/intern/string.h
@@ -152,12 +153,12 @@ date_core.o: $(hdrdir)/ruby/internal/memory.h
date_core.o: $(hdrdir)/ruby/internal/method.h
date_core.o: $(hdrdir)/ruby/internal/module.h
date_core.o: $(hdrdir)/ruby/internal/newobj.h
-date_core.o: $(hdrdir)/ruby/internal/rgengc.h
date_core.o: $(hdrdir)/ruby/internal/scan_args.h
date_core.o: $(hdrdir)/ruby/internal/special_consts.h
date_core.o: $(hdrdir)/ruby/internal/static_assert.h
date_core.o: $(hdrdir)/ruby/internal/stdalign.h
date_core.o: $(hdrdir)/ruby/internal/stdbool.h
+date_core.o: $(hdrdir)/ruby/internal/stdckdint.h
date_core.o: $(hdrdir)/ruby/internal/symbol.h
date_core.o: $(hdrdir)/ruby/internal/value.h
date_core.o: $(hdrdir)/ruby/internal/value_type.h
@@ -227,6 +228,7 @@ date_parse.o: $(hdrdir)/ruby/internal/attr/noexcept.h
date_parse.o: $(hdrdir)/ruby/internal/attr/noinline.h
date_parse.o: $(hdrdir)/ruby/internal/attr/nonnull.h
date_parse.o: $(hdrdir)/ruby/internal/attr/noreturn.h
+date_parse.o: $(hdrdir)/ruby/internal/attr/packed_struct.h
date_parse.o: $(hdrdir)/ruby/internal/attr/pure.h
date_parse.o: $(hdrdir)/ruby/internal/attr/restrict.h
date_parse.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h
@@ -296,7 +298,6 @@ date_parse.o: $(hdrdir)/ruby/internal/intern/enumerator.h
date_parse.o: $(hdrdir)/ruby/internal/intern/error.h
date_parse.o: $(hdrdir)/ruby/internal/intern/eval.h
date_parse.o: $(hdrdir)/ruby/internal/intern/file.h
-date_parse.o: $(hdrdir)/ruby/internal/intern/gc.h
date_parse.o: $(hdrdir)/ruby/internal/intern/hash.h
date_parse.o: $(hdrdir)/ruby/internal/intern/io.h
date_parse.o: $(hdrdir)/ruby/internal/intern/load.h
@@ -313,6 +314,7 @@ date_parse.o: $(hdrdir)/ruby/internal/intern/re.h
date_parse.o: $(hdrdir)/ruby/internal/intern/ruby.h
date_parse.o: $(hdrdir)/ruby/internal/intern/select.h
date_parse.o: $(hdrdir)/ruby/internal/intern/select/largesize.h
+date_parse.o: $(hdrdir)/ruby/internal/intern/set.h
date_parse.o: $(hdrdir)/ruby/internal/intern/signal.h
date_parse.o: $(hdrdir)/ruby/internal/intern/sprintf.h
date_parse.o: $(hdrdir)/ruby/internal/intern/string.h
@@ -327,12 +329,12 @@ date_parse.o: $(hdrdir)/ruby/internal/memory.h
date_parse.o: $(hdrdir)/ruby/internal/method.h
date_parse.o: $(hdrdir)/ruby/internal/module.h
date_parse.o: $(hdrdir)/ruby/internal/newobj.h
-date_parse.o: $(hdrdir)/ruby/internal/rgengc.h
date_parse.o: $(hdrdir)/ruby/internal/scan_args.h
date_parse.o: $(hdrdir)/ruby/internal/special_consts.h
date_parse.o: $(hdrdir)/ruby/internal/static_assert.h
date_parse.o: $(hdrdir)/ruby/internal/stdalign.h
date_parse.o: $(hdrdir)/ruby/internal/stdbool.h
+date_parse.o: $(hdrdir)/ruby/internal/stdckdint.h
date_parse.o: $(hdrdir)/ruby/internal/symbol.h
date_parse.o: $(hdrdir)/ruby/internal/value.h
date_parse.o: $(hdrdir)/ruby/internal/value_type.h
@@ -402,6 +404,7 @@ date_strftime.o: $(hdrdir)/ruby/internal/attr/noexcept.h
date_strftime.o: $(hdrdir)/ruby/internal/attr/noinline.h
date_strftime.o: $(hdrdir)/ruby/internal/attr/nonnull.h
date_strftime.o: $(hdrdir)/ruby/internal/attr/noreturn.h
+date_strftime.o: $(hdrdir)/ruby/internal/attr/packed_struct.h
date_strftime.o: $(hdrdir)/ruby/internal/attr/pure.h
date_strftime.o: $(hdrdir)/ruby/internal/attr/restrict.h
date_strftime.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h
@@ -461,7 +464,6 @@ date_strftime.o: $(hdrdir)/ruby/internal/intern/enumerator.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/error.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/eval.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/file.h
-date_strftime.o: $(hdrdir)/ruby/internal/intern/gc.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/hash.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/io.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/load.h
@@ -478,6 +480,7 @@ date_strftime.o: $(hdrdir)/ruby/internal/intern/re.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/ruby.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/select.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/select/largesize.h
+date_strftime.o: $(hdrdir)/ruby/internal/intern/set.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/signal.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/sprintf.h
date_strftime.o: $(hdrdir)/ruby/internal/intern/string.h
@@ -492,12 +495,12 @@ date_strftime.o: $(hdrdir)/ruby/internal/memory.h
date_strftime.o: $(hdrdir)/ruby/internal/method.h
date_strftime.o: $(hdrdir)/ruby/internal/module.h
date_strftime.o: $(hdrdir)/ruby/internal/newobj.h
-date_strftime.o: $(hdrdir)/ruby/internal/rgengc.h
date_strftime.o: $(hdrdir)/ruby/internal/scan_args.h
date_strftime.o: $(hdrdir)/ruby/internal/special_consts.h
date_strftime.o: $(hdrdir)/ruby/internal/static_assert.h
date_strftime.o: $(hdrdir)/ruby/internal/stdalign.h
date_strftime.o: $(hdrdir)/ruby/internal/stdbool.h
+date_strftime.o: $(hdrdir)/ruby/internal/stdckdint.h
date_strftime.o: $(hdrdir)/ruby/internal/symbol.h
date_strftime.o: $(hdrdir)/ruby/internal/value.h
date_strftime.o: $(hdrdir)/ruby/internal/value_type.h
@@ -564,6 +567,7 @@ date_strptime.o: $(hdrdir)/ruby/internal/attr/noexcept.h
date_strptime.o: $(hdrdir)/ruby/internal/attr/noinline.h
date_strptime.o: $(hdrdir)/ruby/internal/attr/nonnull.h
date_strptime.o: $(hdrdir)/ruby/internal/attr/noreturn.h
+date_strptime.o: $(hdrdir)/ruby/internal/attr/packed_struct.h
date_strptime.o: $(hdrdir)/ruby/internal/attr/pure.h
date_strptime.o: $(hdrdir)/ruby/internal/attr/restrict.h
date_strptime.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h
@@ -633,7 +637,6 @@ date_strptime.o: $(hdrdir)/ruby/internal/intern/enumerator.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/error.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/eval.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/file.h
-date_strptime.o: $(hdrdir)/ruby/internal/intern/gc.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/hash.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/io.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/load.h
@@ -650,6 +653,7 @@ date_strptime.o: $(hdrdir)/ruby/internal/intern/re.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/ruby.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/select.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/select/largesize.h
+date_strptime.o: $(hdrdir)/ruby/internal/intern/set.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/signal.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/sprintf.h
date_strptime.o: $(hdrdir)/ruby/internal/intern/string.h
@@ -664,12 +668,12 @@ date_strptime.o: $(hdrdir)/ruby/internal/memory.h
date_strptime.o: $(hdrdir)/ruby/internal/method.h
date_strptime.o: $(hdrdir)/ruby/internal/module.h
date_strptime.o: $(hdrdir)/ruby/internal/newobj.h
-date_strptime.o: $(hdrdir)/ruby/internal/rgengc.h
date_strptime.o: $(hdrdir)/ruby/internal/scan_args.h
date_strptime.o: $(hdrdir)/ruby/internal/special_consts.h
date_strptime.o: $(hdrdir)/ruby/internal/static_assert.h
date_strptime.o: $(hdrdir)/ruby/internal/stdalign.h
date_strptime.o: $(hdrdir)/ruby/internal/stdbool.h
+date_strptime.o: $(hdrdir)/ruby/internal/stdckdint.h
date_strptime.o: $(hdrdir)/ruby/internal/symbol.h
date_strptime.o: $(hdrdir)/ruby/internal/value.h
date_strptime.o: $(hdrdir)/ruby/internal/value_type.h
diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb
index 358f64173a..8a1467df09 100644
--- a/ext/date/extconf.rb
+++ b/ext/date/extconf.rb
@@ -3,6 +3,7 @@ require 'mkmf'
config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
+append_cflags("-Wno-compound-token-split-by-macro") if RUBY_VERSION < "2.7."
have_func("rb_category_warn")
with_werror("", {:werror => true}) do |opt, |
have_var("timezone", "time.h", opt)
diff --git a/ext/date/lib/date.rb b/ext/date/lib/date.rb
index 88984d7bd2..0cb763017f 100644
--- a/ext/date/lib/date.rb
+++ b/ext/date/lib/date.rb
@@ -4,7 +4,7 @@
require 'date_core'
class Date
- VERSION = '3.2.2' # :nodoc:
+ VERSION = "3.5.1" # :nodoc:
# call-seq:
# infinite? -> false
diff --git a/ext/date/prereq.mk b/ext/date/prereq.mk
index cee7685975..b5d271a32c 100644
--- a/ext/date/prereq.mk
+++ b/ext/date/prereq.mk
@@ -1,7 +1,7 @@
.SUFFIXES: .list
.list.h:
- gperf --ignore-case -C -c -P -p -j1 -i 1 -g -o -t -N $(*F) $< \
+ gperf --ignore-case -L ANSI-C -C -c -P -p -j1 -i 1 -g -o -t -N $(*F) $< \
| sed -f $(top_srcdir)/tool/gperf.sed \
> $(@F)
diff --git a/ext/date/zonetab.h b/ext/date/zonetab.h
index 39a435db16..2a2e8910c9 100644
--- a/ext/date/zonetab.h
+++ b/ext/date/zonetab.h
@@ -1,5 +1,5 @@
/* ANSI-C code produced by gperf version 3.1 */
-/* Command-line: gperf --ignore-case -C -c -P -p -j1 -i 1 -g -o -t -N zonetab zonetab.list */
+/* Command-line: gperf --ignore-case -L ANSI-C -C -c -P -p -j1 -i 1 -g -o -t -N zonetab zonetab.list */
/* Computed positions: -k'1-4,9' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -29,15 +29,17 @@
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
#endif
-#define gperf_offsetof(s, n) (short)offsetof(struct s##_t, s##_str##n)
#line 1 "zonetab.list"
+#define GPERF_DOWNCASE 1
+#define GPERF_CASE_STRNCMP 1
+#define gperf_case_strncmp strncasecmp
struct zone {
int name;
int offset;
};
-static const struct zone *zonetab();
-#line 9 "zonetab.list"
+static const struct zone *zonetab(register const char *str, register size_t len);
+#line 12 "zonetab.list"
struct zone;
#define TOTAL_KEYWORDS 316
@@ -49,7 +51,7 @@ struct zone;
#ifndef GPERF_DOWNCASE
#define GPERF_DOWNCASE 1
-static const unsigned char gperf_downcase[256] =
+static unsigned char gperf_downcase[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@@ -808,736 +810,736 @@ zonetab (register const char *str, register size_t len)
static const struct zone wordlist[] =
{
{-1}, {-1},
-#line 34 "zonetab.list"
- {gperf_offsetof(stringpool, 2), -2*3600},
-#line 43 "zonetab.list"
- {gperf_offsetof(stringpool, 3), -11*3600},
-#line 45 "zonetab.list"
- {gperf_offsetof(stringpool, 4), 0*3600},
-#line 36 "zonetab.list"
- {gperf_offsetof(stringpool, 5), -4*3600},
- {-1}, {-1},
-#line 269 "zonetab.list"
- {gperf_offsetof(stringpool, 8),21600},
-#line 268 "zonetab.list"
- {gperf_offsetof(stringpool, 9),25200},
-#line 35 "zonetab.list"
- {gperf_offsetof(stringpool, 10), -3*3600},
+#line 37 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str2, -2*3600},
+#line 46 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str3, -11*3600},
+#line 48 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str4, 0*3600},
+#line 39 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, -4*3600},
{-1}, {-1},
-#line 21 "zonetab.list"
- {gperf_offsetof(stringpool, 13), 1*3600},
-#line 25 "zonetab.list"
- {gperf_offsetof(stringpool, 14), 5*3600},
-#line 271 "zonetab.list"
- {gperf_offsetof(stringpool, 15),-18000},
-#line 279 "zonetab.list"
- {gperf_offsetof(stringpool, 16),-10800},
-#line 273 "zonetab.list"
- {gperf_offsetof(stringpool, 17),43200},
#line 272 "zonetab.list"
- {gperf_offsetof(stringpool, 18),43200},
-#line 80 "zonetab.list"
- {gperf_offsetof(stringpool, 19), 2*3600},
-#line 186 "zonetab.list"
- {gperf_offsetof(stringpool, 20),36000},
-#line 88 "zonetab.list"
- {gperf_offsetof(stringpool, 21), 3*3600},
-#line 87 "zonetab.list"
- {gperf_offsetof(stringpool, 22), 3*3600},
- {-1},
-#line 101 "zonetab.list"
- {gperf_offsetof(stringpool, 24),-6*3600},
-#line 217 "zonetab.list"
- {gperf_offsetof(stringpool, 25),-18000},
-#line 19 "zonetab.list"
- {gperf_offsetof(stringpool, 26), -8*3600},
-#line 133 "zonetab.list"
- {gperf_offsetof(stringpool, 27), -18000},
-#line 32 "zonetab.list"
- {gperf_offsetof(stringpool, 28), 12*3600},
-#line 56 "zonetab.list"
- {gperf_offsetof(stringpool, 29), -4*3600},
-#line 13 "zonetab.list"
- {gperf_offsetof(stringpool, 30), -5*3600},
-#line 23 "zonetab.list"
- {gperf_offsetof(stringpool, 31), 3*3600},
-#line 256 "zonetab.list"
- {gperf_offsetof(stringpool, 32),23400},
-#line 73 "zonetab.list"
- {gperf_offsetof(stringpool, 33), 1*3600},
- {-1},
-#line 82 "zonetab.list"
- {gperf_offsetof(stringpool, 35), 2*3600},
-#line 71 "zonetab.list"
- {gperf_offsetof(stringpool, 36), 1*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8,21600},
+#line 271 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9,25200},
+#line 38 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, -3*3600},
+ {-1}, {-1},
#line 24 "zonetab.list"
- {gperf_offsetof(stringpool, 37), 4*3600},
-#line 79 "zonetab.list"
- {gperf_offsetof(stringpool, 38), 2*3600},
-#line 65 "zonetab.list"
- {gperf_offsetof(stringpool, 39),2*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, 1*3600},
+#line 28 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, 5*3600},
+#line 274 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15,-18000},
+#line 282 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16,-10800},
+#line 276 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17,43200},
+#line 275 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18,43200},
+#line 83 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, 2*3600},
+#line 189 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20,36000},
+#line 91 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, 3*3600},
+#line 90 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, 3*3600},
{-1},
-#line 202 "zonetab.list"
- {gperf_offsetof(stringpool, 41),28800},
-#line 252 "zonetab.list"
- {gperf_offsetof(stringpool, 42),39600},
-#line 251 "zonetab.list"
- {gperf_offsetof(stringpool, 43),43200},
-#line 17 "zonetab.list"
- {gperf_offsetof(stringpool, 44), -7*3600},
-#line 89 "zonetab.list"
- {gperf_offsetof(stringpool, 45), 3*3600},
-#line 212 "zonetab.list"
- {gperf_offsetof(stringpool, 46),-18000},
-#line 15 "zonetab.list"
- {gperf_offsetof(stringpool, 47), -6*3600},
-#line 192 "zonetab.list"
- {gperf_offsetof(stringpool, 48),18000},
-#line 26 "zonetab.list"
- {gperf_offsetof(stringpool, 49), 6*3600},
- {-1}, {-1},
-#line 51 "zonetab.list"
- {gperf_offsetof(stringpool, 52), -3*3600},
-#line 226 "zonetab.list"
- {gperf_offsetof(stringpool, 53),-7200},
-#line 221 "zonetab.list"
- {gperf_offsetof(stringpool, 54),10800},
+#line 104 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24,-6*3600},
+#line 220 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25,-18000},
#line 22 "zonetab.list"
- {gperf_offsetof(stringpool, 55), 2*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, -8*3600},
+#line 136 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, -18000},
+#line 35 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, 12*3600},
+#line 59 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, -4*3600},
+#line 16 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, -5*3600},
+#line 26 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, 3*3600},
+#line 259 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32,23400},
+#line 76 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, 1*3600},
{-1},
-#line 190 "zonetab.list"
- {gperf_offsetof(stringpool, 57),43200},
-#line 189 "zonetab.list"
- {gperf_offsetof(stringpool, 58),43200},
-#line 199 "zonetab.list"
- {gperf_offsetof(stringpool, 59),28800},
-#line 29 "zonetab.list"
- {gperf_offsetof(stringpool, 60), 9*3600},
-#line 276 "zonetab.list"
- {gperf_offsetof(stringpool, 61),28800},
-#line 48 "zonetab.list"
- {gperf_offsetof(stringpool, 62), -2*3600},
-#line 94 "zonetab.list"
- {gperf_offsetof(stringpool, 63), 6*3600},
+#line 85 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, 2*3600},
#line 74 "zonetab.list"
- {gperf_offsetof(stringpool, 64), 1*3600},
-#line 81 "zonetab.list"
- {gperf_offsetof(stringpool, 65), 2*3600},
-#line 64 "zonetab.list"
- {gperf_offsetof(stringpool, 66),-10*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, 1*3600},
+#line 27 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, 4*3600},
+#line 82 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, 2*3600},
+#line 68 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39,2*3600},
+ {-1},
+#line 205 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41,28800},
+#line 255 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42,39600},
#line 254 "zonetab.list"
- {gperf_offsetof(stringpool, 67),18000},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43,43200},
+#line 20 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, -7*3600},
#line 92 "zonetab.list"
- {gperf_offsetof(stringpool, 68), 5*3600},
- {-1},
-#line 200 "zonetab.list"
- {gperf_offsetof(stringpool, 70),-14400},
-#line 70 "zonetab.list"
- {gperf_offsetof(stringpool, 71), 1*3600},
-#line 281 "zonetab.list"
- {gperf_offsetof(stringpool, 72),32400},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, 3*3600},
+#line 215 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46,-18000},
+#line 18 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, -6*3600},
+#line 195 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str48,18000},
+#line 29 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str49, 6*3600},
+ {-1}, {-1},
+#line 54 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str52, -3*3600},
+#line 229 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str53,-7200},
+#line 224 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str54,10800},
+#line 25 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str55, 2*3600},
{-1},
-#line 280 "zonetab.list"
- {gperf_offsetof(stringpool, 74),39600},
-#line 238 "zonetab.list"
- {gperf_offsetof(stringpool, 75),21600},
-#line 93 "zonetab.list"
- {gperf_offsetof(stringpool, 76), (5*3600+1800)},
-#line 194 "zonetab.list"
- {gperf_offsetof(stringpool, 77),28800},
+#line 193 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str57,43200},
+#line 192 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str58,43200},
+#line 202 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str59,28800},
+#line 32 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str60, 9*3600},
+#line 279 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str61,28800},
+#line 51 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str62, -2*3600},
+#line 97 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str63, 6*3600},
+#line 77 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str64, 1*3600},
+#line 84 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str65, 2*3600},
+#line 67 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str66,-10*3600},
+#line 257 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str67,18000},
+#line 95 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str68, 5*3600},
{-1},
-#line 255 "zonetab.list"
- {gperf_offsetof(stringpool, 79),43200},
-#line 75 "zonetab.list"
- {gperf_offsetof(stringpool, 80), 1*3600},
-#line 270 "zonetab.list"
- {gperf_offsetof(stringpool, 81),18000},
-#line 83 "zonetab.list"
- {gperf_offsetof(stringpool, 82), 2*3600},
+#line 203 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str70,-14400},
+#line 73 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str71, 1*3600},
+#line 284 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str72,32400},
{-1},
-#line 207 "zonetab.list"
- {gperf_offsetof(stringpool, 84),36000},
-#line 278 "zonetab.list"
- {gperf_offsetof(stringpool, 85),-7200},
- {-1}, {-1},
-#line 126 "zonetab.list"
- {gperf_offsetof(stringpool, 88), -21600},
-#line 185 "zonetab.list"
- {gperf_offsetof(stringpool, 89),39600},
-#line 183 "zonetab.list"
- {gperf_offsetof(stringpool, 90),-18000},
-#line 218 "zonetab.list"
- {gperf_offsetof(stringpool, 91),-18000},
-#line 182 "zonetab.list"
- {gperf_offsetof(stringpool, 92),34200},
-#line 103 "zonetab.list"
- {gperf_offsetof(stringpool, 93),11*3600},
-#line 53 "zonetab.list"
- {gperf_offsetof(stringpool, 94), -3*3600},
-#line 208 "zonetab.list"
- {gperf_offsetof(stringpool, 95),36000},
-#line 49 "zonetab.list"
- {gperf_offsetof(stringpool, 96),-2*3600},
-#line 120 "zonetab.list"
- {gperf_offsetof(stringpool, 97), 34200},
- {-1}, {-1},
-#line 215 "zonetab.list"
- {gperf_offsetof(stringpool, 100),25200},
-#line 242 "zonetab.list"
- {gperf_offsetof(stringpool, 101),12600},
+#line 283 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str74,39600},
#line 241 "zonetab.list"
- {gperf_offsetof(stringpool, 102),28800},
-#line 240 "zonetab.list"
- {gperf_offsetof(stringpool, 103),32400},
-#line 86 "zonetab.list"
- {gperf_offsetof(stringpool, 104), 3*3600},
-#line 33 "zonetab.list"
- {gperf_offsetof(stringpool, 105), -1*3600},
-#line 201 "zonetab.list"
- {gperf_offsetof(stringpool, 106),21600},
-#line 148 "zonetab.list"
- {gperf_offsetof(stringpool, 107), -25200},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str75,21600},
#line 96 "zonetab.list"
- {gperf_offsetof(stringpool, 108), (6*3600+1800)},
-#line 42 "zonetab.list"
- {gperf_offsetof(stringpool, 109), -10*3600},
-#line 31 "zonetab.list"
- {gperf_offsetof(stringpool, 110), 11*3600},
-#line 72 "zonetab.list"
- {gperf_offsetof(stringpool, 111), 1*3600},
- {-1},
-#line 90 "zonetab.list"
- {gperf_offsetof(stringpool, 113), 4*3600},
-#line 47 "zonetab.list"
- {gperf_offsetof(stringpool, 114), 0*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str76, (5*3600+1800)},
+#line 197 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str77,28800},
{-1},
+#line 258 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str79,43200},
#line 78 "zonetab.list"
- {gperf_offsetof(stringpool, 116), 1*3600},
-#line 77 "zonetab.list"
- {gperf_offsetof(stringpool, 117), 1*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str80, 1*3600},
+#line 273 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str81,18000},
+#line 86 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str82, 2*3600},
{-1},
-#line 95 "zonetab.list"
- {gperf_offsetof(stringpool, 119), 2*3600},
-#line 313 "zonetab.list"
- {gperf_offsetof(stringpool, 120),43200},
-#line 55 "zonetab.list"
- {gperf_offsetof(stringpool, 121), -(2*3600+1800)},
-#line 184 "zonetab.list"
- {gperf_offsetof(stringpool, 122),31500},
-#line 204 "zonetab.list"
- {gperf_offsetof(stringpool, 123),45900},
#line 210 "zonetab.list"
- {gperf_offsetof(stringpool, 124),-18000},
-#line 198 "zonetab.list"
- {gperf_offsetof(stringpool, 125),14400},
-#line 57 "zonetab.list"
- {gperf_offsetof(stringpool, 126), -4*3600},
-#line 197 "zonetab.list"
- {gperf_offsetof(stringpool, 127),18000},
-#line 54 "zonetab.list"
- {gperf_offsetof(stringpool, 128),-3*3600},
-#line 253 "zonetab.list"
- {gperf_offsetof(stringpool, 129),-30600},
-#line 91 "zonetab.list"
- {gperf_offsetof(stringpool, 130), 4*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str84,36000},
+#line 281 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str85,-7200},
+ {-1}, {-1},
+#line 129 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str88, -21600},
+#line 188 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str89,39600},
+#line 186 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str90,-18000},
+#line 221 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str91,-18000},
+#line 185 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str92,34200},
+#line 106 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str93,11*3600},
+#line 56 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str94, -3*3600},
+#line 211 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str95,36000},
+#line 52 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str96,-2*3600},
+#line 123 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str97, 34200},
+ {-1}, {-1},
+#line 218 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str100,25200},
+#line 245 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str101,12600},
+#line 244 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str102,28800},
+#line 243 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str103,32400},
+#line 89 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str104, 3*3600},
+#line 36 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str105, -1*3600},
+#line 204 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str106,21600},
+#line 151 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str107, -25200},
#line 99 "zonetab.list"
- {gperf_offsetof(stringpool, 131), 9*3600},
-#line 122 "zonetab.list"
- {gperf_offsetof(stringpool, 132), 21600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str108, (6*3600+1800)},
+#line 45 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str109, -10*3600},
+#line 34 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str110, 11*3600},
+#line 75 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str111, 1*3600},
+ {-1},
+#line 93 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str113, 4*3600},
+#line 50 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str114, 0*3600},
+ {-1},
+#line 81 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str116, 1*3600},
+#line 80 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str117, 1*3600},
+ {-1},
+#line 98 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str119, 2*3600},
+#line 316 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str120,43200},
+#line 58 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str121, -(2*3600+1800)},
#line 187 "zonetab.list"
- {gperf_offsetof(stringpool, 133),16200},
-#line 132 "zonetab.list"
- {gperf_offsetof(stringpool, 134), -10800},
-#line 121 "zonetab.list"
- {gperf_offsetof(stringpool, 135), -21600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str122,31500},
+#line 207 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str123,45900},
+#line 213 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str124,-18000},
+#line 201 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str125,14400},
+#line 60 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str126, -4*3600},
+#line 200 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str127,18000},
+#line 57 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str128,-3*3600},
+#line 256 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str129,-30600},
+#line 94 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str130, 4*3600},
+#line 102 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str131, 9*3600},
+#line 125 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str132, 21600},
+#line 190 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str133,16200},
+#line 135 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str134, -10800},
+#line 124 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str135, -21600},
{-1},
-#line 236 "zonetab.list"
- {gperf_offsetof(stringpool, 137),25200},
+#line 239 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str137,25200},
{-1}, {-1}, {-1}, {-1}, {-1},
-#line 274 "zonetab.list"
- {gperf_offsetof(stringpool, 143),36000},
-#line 266 "zonetab.list"
- {gperf_offsetof(stringpool, 144),43200},
-#line 146 "zonetab.list"
- {gperf_offsetof(stringpool, 145), -21600},
-#line 193 "zonetab.list"
- {gperf_offsetof(stringpool, 146),32400},
-#line 220 "zonetab.list"
- {gperf_offsetof(stringpool, 147),-3600},
-#line 214 "zonetab.list"
- {gperf_offsetof(stringpool, 148),25200},
-#line 219 "zonetab.list"
- {gperf_offsetof(stringpool, 149),0},
-#line 275 "zonetab.list"
- {gperf_offsetof(stringpool, 150),46800},
-#line 109 "zonetab.list"
- {gperf_offsetof(stringpool, 151), -32400},
+#line 277 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str143,36000},
+#line 269 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str144,43200},
+#line 149 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str145, -21600},
+#line 196 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str146,32400},
+#line 223 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str147,-3600},
+#line 217 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str148,25200},
+#line 222 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str149,0},
+#line 278 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str150,46800},
+#line 112 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str151, -32400},
{-1}, {-1},
-#line 68 "zonetab.list"
- {gperf_offsetof(stringpool, 154), -11*3600},
+#line 71 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str154, -11*3600},
{-1}, {-1}, {-1},
-#line 321 "zonetab.list"
- {gperf_offsetof(stringpool, 158),0},
+#line 324 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str158,0},
{-1},
-#line 178 "zonetab.list"
- {gperf_offsetof(stringpool, 160), 18000},
#line 181 "zonetab.list"
- {gperf_offsetof(stringpool, 161),37800},
-#line 265 "zonetab.list"
- {gperf_offsetof(stringpool, 162),20700},
-#line 249 "zonetab.list"
- {gperf_offsetof(stringpool, 163),37800},
-#line 108 "zonetab.list"
- {gperf_offsetof(stringpool, 164), 16200},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str160, 18000},
+#line 184 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str161,37800},
+#line 268 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str162,20700},
+#line 252 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str163,37800},
+#line 111 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str164, 16200},
{-1}, {-1},
+#line 33 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str167, 10*3600},
+ {-1},
#line 30 "zonetab.list"
- {gperf_offsetof(stringpool, 167), 10*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str169, 7*3600},
+#line 242 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str170,16200},
+#line 209 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str171,28800},
+#line 208 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str172,32400},
+#line 15 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str173, 0*3600},
+#line 232 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str174,14400},
+#line 267 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str175,25200},
+#line 266 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str176,25200},
+#line 226 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str177,43200},
+#line 43 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str178, -8*3600},
+#line 225 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str179,46800},
{-1},
-#line 27 "zonetab.list"
- {gperf_offsetof(stringpool, 169), 7*3600},
-#line 239 "zonetab.list"
- {gperf_offsetof(stringpool, 170),16200},
-#line 206 "zonetab.list"
- {gperf_offsetof(stringpool, 171),28800},
-#line 205 "zonetab.list"
- {gperf_offsetof(stringpool, 172),32400},
-#line 12 "zonetab.list"
- {gperf_offsetof(stringpool, 173), 0*3600},
-#line 229 "zonetab.list"
- {gperf_offsetof(stringpool, 174),14400},
-#line 264 "zonetab.list"
- {gperf_offsetof(stringpool, 175),25200},
+#line 285 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str181,-10800},
#line 263 "zonetab.list"
- {gperf_offsetof(stringpool, 176),25200},
-#line 223 "zonetab.list"
- {gperf_offsetof(stringpool, 177),43200},
-#line 40 "zonetab.list"
- {gperf_offsetof(stringpool, 178), -8*3600},
-#line 222 "zonetab.list"
- {gperf_offsetof(stringpool, 179),46800},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str182,39600},
+#line 103 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str183, 9*3600},
+#line 247 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str184,39600},
+#line 105 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str185, 10*3600},
+#line 146 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str186, 12600},
+#line 132 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str187, 10800},
+#line 101 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str188, 8*3600},
+#line 42 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str189, -7*3600},
+#line 133 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str190, 36000},
+#line 41 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str191, -6*3600},
+#line 206 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str192,49500},
+#line 301 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str193,18000},
+#line 212 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str194,-14400},
+#line 194 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str195,-43200},
{-1},
-#line 282 "zonetab.list"
- {gperf_offsetof(stringpool, 181),-10800},
+#line 262 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str197,28800},
+#line 182 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str198, 36000},
#line 260 "zonetab.list"
- {gperf_offsetof(stringpool, 182),39600},
-#line 100 "zonetab.list"
- {gperf_offsetof(stringpool, 183), 9*3600},
-#line 244 "zonetab.list"
- {gperf_offsetof(stringpool, 184),39600},
-#line 102 "zonetab.list"
- {gperf_offsetof(stringpool, 185), 10*3600},
-#line 143 "zonetab.list"
- {gperf_offsetof(stringpool, 186), 12600},
-#line 129 "zonetab.list"
- {gperf_offsetof(stringpool, 187), 10800},
-#line 98 "zonetab.list"
- {gperf_offsetof(stringpool, 188), 8*3600},
-#line 39 "zonetab.list"
- {gperf_offsetof(stringpool, 189), -7*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str199,14400},
+#line 322 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str200,32400},
+#line 87 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str201, 2*3600},
+#line 289 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str202,39600},
+#line 155 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str203, 43200},
+#line 303 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str204,46800},
#line 130 "zonetab.list"
- {gperf_offsetof(stringpool, 190), 36000},
-#line 38 "zonetab.list"
- {gperf_offsetof(stringpool, 191), -6*3600},
-#line 203 "zonetab.list"
- {gperf_offsetof(stringpool, 192),49500},
-#line 298 "zonetab.list"
- {gperf_offsetof(stringpool, 193),18000},
-#line 209 "zonetab.list"
- {gperf_offsetof(stringpool, 194),-14400},
-#line 191 "zonetab.list"
- {gperf_offsetof(stringpool, 195),-43200},
- {-1},
-#line 259 "zonetab.list"
- {gperf_offsetof(stringpool, 197),28800},
-#line 179 "zonetab.list"
- {gperf_offsetof(stringpool, 198), 36000},
-#line 257 "zonetab.list"
- {gperf_offsetof(stringpool, 199),14400},
-#line 319 "zonetab.list"
- {gperf_offsetof(stringpool, 200),32400},
-#line 84 "zonetab.list"
- {gperf_offsetof(stringpool, 201), 2*3600},
-#line 286 "zonetab.list"
- {gperf_offsetof(stringpool, 202),39600},
-#line 152 "zonetab.list"
- {gperf_offsetof(stringpool, 203), 43200},
-#line 300 "zonetab.list"
- {gperf_offsetof(stringpool, 204),46800},
-#line 127 "zonetab.list"
- {gperf_offsetof(stringpool, 205), 28800},
-#line 299 "zonetab.list"
- {gperf_offsetof(stringpool, 206),50400},
-#line 85 "zonetab.list"
- {gperf_offsetof(stringpool, 207), -11*3600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str205, 28800},
+#line 302 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str206,50400},
+#line 88 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str207, -11*3600},
{-1},
-#line 142 "zonetab.list"
- {gperf_offsetof(stringpool, 209), 19800},
+#line 145 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str209, 19800},
{-1},
-#line 314 "zonetab.list"
- {gperf_offsetof(stringpool, 211),-10800},
-#line 288 "zonetab.list"
- {gperf_offsetof(stringpool, 212),39600},
+#line 317 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str211,-10800},
+#line 291 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str212,39600},
{-1},
-#line 196 "zonetab.list"
- {gperf_offsetof(stringpool, 214),-3600},
-#line 195 "zonetab.list"
- {gperf_offsetof(stringpool, 215),0},
-#line 293 "zonetab.list"
- {gperf_offsetof(stringpool, 216),-36000},
-#line 106 "zonetab.list"
- {gperf_offsetof(stringpool, 217), 12*3600},
+#line 199 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str214,-3600},
+#line 198 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str215,0},
+#line 296 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str216,-36000},
+#line 109 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str217, 12*3600},
+#line 131 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str218, -43200},
+#line 108 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str219,12*3600},
+#line 173 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str220, 32400},
#line 128 "zonetab.list"
- {gperf_offsetof(stringpool, 218), -43200},
-#line 105 "zonetab.list"
- {gperf_offsetof(stringpool, 219),12*3600},
-#line 170 "zonetab.list"
- {gperf_offsetof(stringpool, 220), 32400},
-#line 125 "zonetab.list"
- {gperf_offsetof(stringpool, 221), 39600},
- {-1},
-#line 283 "zonetab.list"
- {gperf_offsetof(stringpool, 223),21600},
-#line 113 "zonetab.list"
- {gperf_offsetof(stringpool, 224), -14400},
-#line 262 "zonetab.list"
- {gperf_offsetof(stringpool, 225),39600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str221, 39600},
{-1},
-#line 11 "zonetab.list"
- {gperf_offsetof(stringpool, 227), 0*3600},
-#line 301 "zonetab.list"
- {gperf_offsetof(stringpool, 228),10800},
-#line 315 "zonetab.list"
- {gperf_offsetof(stringpool, 229),43200},
-#line 291 "zonetab.list"
- {gperf_offsetof(stringpool, 230),-10800},
-#line 20 "zonetab.list"
- {gperf_offsetof(stringpool, 231), -7*3600},
-#line 248 "zonetab.list"
- {gperf_offsetof(stringpool, 232),39600},
+#line 286 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str223,21600},
+#line 116 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str224, -14400},
+#line 265 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str225,39600},
{-1},
-#line 52 "zonetab.list"
- {gperf_offsetof(stringpool, 234), -3*3600},
#line 14 "zonetab.list"
- {gperf_offsetof(stringpool, 235), -4*3600},
- {-1}, {-1},
-#line 277 "zonetab.list"
- {gperf_offsetof(stringpool, 238),18000},
-#line 188 "zonetab.list"
- {gperf_offsetof(stringpool, 239),21600},
-#line 320 "zonetab.list"
- {gperf_offsetof(stringpool, 240),28800},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str227, 0*3600},
+#line 304 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str228,10800},
+#line 318 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str229,43200},
+#line 294 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str230,-10800},
+#line 23 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str231, -7*3600},
+#line 251 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str232,39600},
{-1},
-#line 317 "zonetab.list"
- {gperf_offsetof(stringpool, 242),-10800},
-#line 60 "zonetab.list"
- {gperf_offsetof(stringpool, 243),-9*3600},
-#line 316 "zonetab.list"
- {gperf_offsetof(stringpool, 244),-7200},
+#line 55 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str234, -3*3600},
+#line 17 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str235, -4*3600},
+ {-1}, {-1},
+#line 280 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str238,18000},
+#line 191 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str239,21600},
+#line 323 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str240,28800},
{-1},
-#line 246 "zonetab.list"
- {gperf_offsetof(stringpool, 246),25200},
-#line 245 "zonetab.list"
- {gperf_offsetof(stringpool, 247),28800},
-#line 147 "zonetab.list"
- {gperf_offsetof(stringpool, 248), -7200},
-#line 18 "zonetab.list"
- {gperf_offsetof(stringpool, 249), -6*3600},
-#line 250 "zonetab.list"
- {gperf_offsetof(stringpool, 250),50400},
-#line 165 "zonetab.list"
- {gperf_offsetof(stringpool, 251), 28800},
-#line 16 "zonetab.list"
- {gperf_offsetof(stringpool, 252), -5*3600},
-#line 76 "zonetab.list"
- {gperf_offsetof(stringpool, 253), 1*3600},
+#line 320 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str242,-7200},
+#line 63 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str243,-9*3600},
+#line 319 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str244,-3600},
{-1},
-#line 164 "zonetab.list"
- {gperf_offsetof(stringpool, 255), 25200},
-#line 41 "zonetab.list"
- {gperf_offsetof(stringpool, 256), -9*3600},
+#line 249 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str246,25200},
+#line 248 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str247,28800},
+#line 150 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str248, -7200},
+#line 21 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str249, -6*3600},
+#line 253 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str250,50400},
+#line 168 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str251, 28800},
+#line 19 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str252, -5*3600},
+#line 79 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str253, 1*3600},
{-1},
-#line 171 "zonetab.list"
- {gperf_offsetof(stringpool, 258), 46800},
-#line 211 "zonetab.list"
- {gperf_offsetof(stringpool, 259),-36000},
+#line 167 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str255, 25200},
+#line 44 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str256, -9*3600},
{-1},
-#line 308 "zonetab.list"
- {gperf_offsetof(stringpool, 261),-14400},
-#line 119 "zonetab.list"
- {gperf_offsetof(stringpool, 262), 14400},
-#line 123 "zonetab.list"
- {gperf_offsetof(stringpool, 263), 3600},
-#line 28 "zonetab.list"
- {gperf_offsetof(stringpool, 264), 8*3600},
-#line 124 "zonetab.list"
- {gperf_offsetof(stringpool, 265), 3600},
-#line 153 "zonetab.list"
- {gperf_offsetof(stringpool, 266), -12600},
-#line 110 "zonetab.list"
- {gperf_offsetof(stringpool, 267), 10800},
-#line 289 "zonetab.list"
- {gperf_offsetof(stringpool, 268),14400},
-#line 112 "zonetab.list"
- {gperf_offsetof(stringpool, 269), 10800},
-#line 111 "zonetab.list"
- {gperf_offsetof(stringpool, 270), 14400},
-#line 216 "zonetab.list"
- {gperf_offsetof(stringpool, 271),36000},
+#line 174 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str258, 46800},
+#line 214 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str259,-36000},
{-1},
#line 311 "zonetab.list"
- {gperf_offsetof(stringpool, 273),21600},
-#line 66 "zonetab.list"
- {gperf_offsetof(stringpool, 274),-10*3600},
-#line 151 "zonetab.list"
- {gperf_offsetof(stringpool, 275), 20700},
-#line 267 "zonetab.list"
- {gperf_offsetof(stringpool, 276),-39600},
-#line 225 "zonetab.list"
- {gperf_offsetof(stringpool, 277),-14400},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str261,-14400},
+#line 122 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str262, 14400},
+#line 126 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str263, 3600},
+#line 31 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str264, 8*3600},
+#line 127 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str265, 3600},
+#line 156 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str266, -12600},
+#line 113 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str267, 10800},
+#line 292 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str268,14400},
+#line 115 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str269, 10800},
+#line 114 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str270, 14400},
+#line 219 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str271,36000},
{-1},
-#line 224 "zonetab.list"
- {gperf_offsetof(stringpool, 279),-10800},
-#line 67 "zonetab.list"
- {gperf_offsetof(stringpool, 280),-10*3600},
-#line 237 "zonetab.list"
- {gperf_offsetof(stringpool, 281),10800},
+#line 314 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str273,21600},
+#line 69 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str274,-10*3600},
+#line 154 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str275, 20700},
+#line 270 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str276,-39600},
+#line 228 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str277,-14400},
+ {-1},
+#line 227 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str279,-10800},
+#line 70 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str280,-10*3600},
+#line 240 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str281,10800},
{-1}, {-1},
-#line 297 "zonetab.list"
- {gperf_offsetof(stringpool, 284),32400},
-#line 175 "zonetab.list"
- {gperf_offsetof(stringpool, 285), 28800},
-#line 134 "zonetab.list"
- {gperf_offsetof(stringpool, 286), 7200},
-#line 149 "zonetab.list"
- {gperf_offsetof(stringpool, 287), 23400},
-#line 107 "zonetab.list"
- {gperf_offsetof(stringpool, 288),13*3600},
-#line 230 "zonetab.list"
- {gperf_offsetof(stringpool, 289),-10800},
-#line 307 "zonetab.list"
- {gperf_offsetof(stringpool, 290),18000},
+#line 300 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str284,32400},
+#line 178 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str285, 28800},
+#line 137 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str286, 7200},
+#line 152 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str287, 23400},
+#line 110 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str288,13*3600},
+#line 233 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str289,-10800},
+#line 310 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str290,18000},
{-1}, {-1},
-#line 155 "zonetab.list"
- {gperf_offsetof(stringpool, 293), 25200},
-#line 258 "zonetab.list"
- {gperf_offsetof(stringpool, 294),18000},
-#line 227 "zonetab.list"
- {gperf_offsetof(stringpool, 295),-21600},
+#line 158 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str293, 25200},
#line 261 "zonetab.list"
- {gperf_offsetof(stringpool, 296),43200},
-#line 213 "zonetab.list"
- {gperf_offsetof(stringpool, 297),-3600},
-#line 154 "zonetab.list"
- {gperf_offsetof(stringpool, 298), 28800},
- {-1},
-#line 243 "zonetab.list"
- {gperf_offsetof(stringpool, 300),21600},
-#line 114 "zonetab.list"
- {gperf_offsetof(stringpool, 301), 34200},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str294,18000},
+#line 230 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str295,-21600},
+#line 264 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str296,43200},
+#line 216 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str297,-3600},
#line 157 "zonetab.list"
- {gperf_offsetof(stringpool, 302), -28800},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str298, 28800},
{-1},
+#line 246 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str300,21600},
#line 117 "zonetab.list"
- {gperf_offsetof(stringpool, 304), -21600},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str301, 34200},
+#line 160 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str302, -28800},
{-1},
-#line 156 "zonetab.list"
- {gperf_offsetof(stringpool, 306), -14400},
-#line 116 "zonetab.list"
- {gperf_offsetof(stringpool, 307), -3600},
-#line 228 "zonetab.list"
- {gperf_offsetof(stringpool, 308),-32400},
-#line 294 "zonetab.list"
- {gperf_offsetof(stringpool, 309),18000},
-#line 37 "zonetab.list"
- {gperf_offsetof(stringpool, 310), -5*3600},
-#line 137 "zonetab.list"
- {gperf_offsetof(stringpool, 311), 7200},
-#line 58 "zonetab.list"
- {gperf_offsetof(stringpool, 312),-8*3600},
-#line 304 "zonetab.list"
- {gperf_offsetof(stringpool, 313),28800},
-#line 303 "zonetab.list"
- {gperf_offsetof(stringpool, 314),32400},
-#line 284 "zonetab.list"
- {gperf_offsetof(stringpool, 315),14400},
+#line 120 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str304, -21600},
{-1},
-#line 295 "zonetab.list"
- {gperf_offsetof(stringpool, 317),18000},
+#line 159 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str306, -14400},
+#line 119 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str307, -3600},
+#line 231 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str308,-32400},
+#line 297 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str309,18000},
+#line 40 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str310, -5*3600},
+#line 140 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str311, 7200},
+#line 61 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str312,-8*3600},
+#line 307 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str313,28800},
+#line 306 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str314,32400},
+#line 287 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str315,14400},
{-1},
-#line 166 "zonetab.list"
- {gperf_offsetof(stringpool, 319), 7200},
+#line 298 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str317,18000},
+ {-1},
+#line 169 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str319, 7200},
{-1}, {-1}, {-1}, {-1},
-#line 97 "zonetab.list"
- {gperf_offsetof(stringpool, 324), 8*3600},
+#line 100 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str324, 8*3600},
{-1},
-#line 50 "zonetab.list"
- {gperf_offsetof(stringpool, 326), -(1*3600+1800)},
-#line 285 "zonetab.list"
- {gperf_offsetof(stringpool, 327),-10800},
+#line 53 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str326, -(1*3600+1800)},
+#line 288 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str327,-10800},
{-1}, {-1},
-#line 287 "zonetab.list"
- {gperf_offsetof(stringpool, 330),14400},
+#line 290 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str330,14400},
{-1},
-#line 169 "zonetab.list"
- {gperf_offsetof(stringpool, 332), 36000},
+#line 172 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str332, 36000},
{-1},
-#line 235 "zonetab.list"
- {gperf_offsetof(stringpool, 334),25200},
-#line 234 "zonetab.list"
- {gperf_offsetof(stringpool, 335),28800},
+#line 238 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str334,25200},
+#line 237 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str335,28800},
{-1}, {-1},
-#line 232 "zonetab.list"
- {gperf_offsetof(stringpool, 338),-14400},
+#line 235 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str338,-14400},
{-1}, {-1}, {-1},
-#line 44 "zonetab.list"
- {gperf_offsetof(stringpool, 342), -12*3600},
-#line 61 "zonetab.list"
- {gperf_offsetof(stringpool, 343),-9*3600},
-#line 162 "zonetab.list"
- {gperf_offsetof(stringpool, 344), -14400},
-#line 141 "zonetab.list"
- {gperf_offsetof(stringpool, 345), -36000},
+#line 47 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str342, -12*3600},
+#line 64 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str343,-9*3600},
+#line 165 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str344, -14400},
+#line 144 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str345, -36000},
{-1},
-#line 306 "zonetab.list"
- {gperf_offsetof(stringpool, 347),-10800},
+#line 309 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str347,-10800},
{-1},
-#line 305 "zonetab.list"
- {gperf_offsetof(stringpool, 349),-7200},
+#line 308 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str349,-7200},
+#line 329 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str350,18000},
+#line 328 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str351,21600},
+#line 250 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str352,14400},
#line 326 "zonetab.list"
- {gperf_offsetof(stringpool, 350),18000},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str353,32400},
#line 325 "zonetab.list"
- {gperf_offsetof(stringpool, 351),21600},
-#line 247 "zonetab.list"
- {gperf_offsetof(stringpool, 352),14400},
-#line 323 "zonetab.list"
- {gperf_offsetof(stringpool, 353),32400},
-#line 322 "zonetab.list"
- {gperf_offsetof(stringpool, 354),36000},
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str354,36000},
{-1}, {-1}, {-1},
-#line 63 "zonetab.list"
- {gperf_offsetof(stringpool, 358), -9*3600},
-#line 144 "zonetab.list"
- {gperf_offsetof(stringpool, 359), 7200},
+#line 66 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str358, -9*3600},
+#line 147 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str359, 7200},
{-1}, {-1}, {-1}, {-1}, {-1},
-#line 167 "zonetab.list"
- {gperf_offsetof(stringpool, 365), 21600},
+#line 170 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str365, 21600},
{-1},
-#line 180 "zonetab.list"
- {gperf_offsetof(stringpool, 367), 32400},
+#line 183 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str367, 32400},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 318 "zonetab.list"
- {gperf_offsetof(stringpool, 375),25200},
+#line 321 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str375,25200},
{-1},
-#line 115 "zonetab.list"
- {gperf_offsetof(stringpool, 377), 36000},
-#line 231 "zonetab.list"
- {gperf_offsetof(stringpool, 378),43200},
+#line 118 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str377, 36000},
+#line 234 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str378,43200},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 173 "zonetab.list"
- {gperf_offsetof(stringpool, 387), -25200},
+#line 176 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str387, -25200},
{-1}, {-1}, {-1},
-#line 310 "zonetab.list"
- {gperf_offsetof(stringpool, 391),36000},
-#line 309 "zonetab.list"
- {gperf_offsetof(stringpool, 392),39600},
+#line 313 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str391,36000},
+#line 312 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str392,39600},
{-1}, {-1},
-#line 140 "zonetab.list"
- {gperf_offsetof(stringpool, 395), 7200},
+#line 143 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str395, 7200},
{-1}, {-1},
-#line 168 "zonetab.list"
- {gperf_offsetof(stringpool, 398), 28800},
-#line 290 "zonetab.list"
- {gperf_offsetof(stringpool, 399),39600},
+#line 171 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str398, 28800},
+#line 293 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str399,39600},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 118 "zonetab.list"
- {gperf_offsetof(stringpool, 408), -3600},
+#line 121 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str408, -3600},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 296 "zonetab.list"
- {gperf_offsetof(stringpool, 417),46800},
-#line 163 "zonetab.list"
- {gperf_offsetof(stringpool, 418), -39600},
+#line 299 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str417,46800},
+#line 166 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str418, -39600},
{-1}, {-1},
-#line 161 "zonetab.list"
- {gperf_offsetof(stringpool, 421), -18000},
+#line 164 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str421, -18000},
{-1}, {-1}, {-1}, {-1}, {-1},
-#line 312 "zonetab.list"
- {gperf_offsetof(stringpool, 427),39600},
-#line 69 "zonetab.list"
- {gperf_offsetof(stringpool, 428),-12*3600},
+#line 315 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str427,39600},
+#line 72 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str428,-12*3600},
{-1}, {-1}, {-1},
-#line 136 "zonetab.list"
- {gperf_offsetof(stringpool, 432), 43200},
+#line 139 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str432, 43200},
{-1}, {-1},
-#line 46 "zonetab.list"
- {gperf_offsetof(stringpool, 435), 0*3600},
+#line 49 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str435, 0*3600},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 145 "zonetab.list"
- {gperf_offsetof(stringpool, 443), 32400},
+#line 148 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str443, 32400},
{-1},
-#line 131 "zonetab.list"
- {gperf_offsetof(stringpool, 445), 7200},
+#line 134 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str445, 7200},
{-1}, {-1}, {-1},
-#line 292 "zonetab.list"
- {gperf_offsetof(stringpool, 449),10800},
+#line 295 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str449,10800},
{-1}, {-1},
-#line 150 "zonetab.list"
- {gperf_offsetof(stringpool, 452), 21600},
+#line 153 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str452, 21600},
{-1}, {-1},
-#line 302 "zonetab.list"
- {gperf_offsetof(stringpool, 455),43200},
+#line 305 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str455,43200},
{-1}, {-1},
-#line 176 "zonetab.list"
- {gperf_offsetof(stringpool, 458), 3600},
+#line 179 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str458, 3600},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 135 "zonetab.list"
- {gperf_offsetof(stringpool, 466), 18000},
+#line 138 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str466, 18000},
{-1},
-#line 174 "zonetab.list"
- {gperf_offsetof(stringpool, 468), 36000},
+#line 177 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str468, 36000},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 324 "zonetab.list"
- {gperf_offsetof(stringpool, 476),36000},
-#line 172 "zonetab.list"
- {gperf_offsetof(stringpool, 477), -18000},
+#line 327 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str476,36000},
+#line 175 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str477, -18000},
{-1}, {-1}, {-1}, {-1},
-#line 160 "zonetab.list"
- {gperf_offsetof(stringpool, 482), -10800},
+#line 163 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str482, -10800},
{-1}, {-1},
-#line 62 "zonetab.list"
- {gperf_offsetof(stringpool, 485), -9*3600},
-#line 159 "zonetab.list"
- {gperf_offsetof(stringpool, 486), 10800},
+#line 65 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str485, -9*3600},
+#line 162 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str486, 10800},
{-1}, {-1}, {-1}, {-1}, {-1},
-#line 233 "zonetab.list"
- {gperf_offsetof(stringpool, 492),28800},
+#line 236 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str492,28800},
{-1}, {-1}, {-1}, {-1},
-#line 158 "zonetab.list"
- {gperf_offsetof(stringpool, 497), 3600},
+#line 161 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str497, 3600},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 177 "zonetab.list"
- {gperf_offsetof(stringpool, 540), 3600},
+#line 180 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str540, 3600},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
-#line 59 "zonetab.list"
- {gperf_offsetof(stringpool, 563), -8*3600},
+#line 62 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str563, -8*3600},
{-1}, {-1},
-#line 104 "zonetab.list"
- {gperf_offsetof(stringpool, 566),12*3600},
-#line 139 "zonetab.list"
- {gperf_offsetof(stringpool, 567), 0},
+#line 107 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str566,12*3600},
+#line 142 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str567, 0},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 138 "zonetab.list"
- {gperf_offsetof(stringpool, 619), -10800}
+#line 141 "zonetab.list"
+ {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str619, -10800}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -1558,5 +1560,5 @@ zonetab (register const char *str, register size_t len)
}
return 0;
}
-#line 327 "zonetab.list"
+#line 330 "zonetab.list"
diff --git a/ext/date/zonetab.list b/ext/date/zonetab.list
index d2f902d2d5..63b6873447 100644
--- a/ext/date/zonetab.list
+++ b/ext/date/zonetab.list
@@ -1,9 +1,12 @@
%{
+#define GPERF_DOWNCASE 1
+#define GPERF_CASE_STRNCMP 1
+#define gperf_case_strncmp strncasecmp
struct zone {
int name;
int offset;
};
-static const struct zone *zonetab();
+static const struct zone *zonetab(register const char *str, register size_t len);
%}
struct zone;
@@ -313,8 +316,8 @@ vut,39600
wakt,43200
warst,-10800
wft,43200
-wgst,-7200
-wgt,-10800
+wgst,-3600
+wgt,-7200
wib,25200
wit,32400
wita,28800