date 3.0.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of date might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eab8784935560e8ccb987a8c6349a055e6a81a9d0350f3c6bd3bc82457132483
4
- data.tar.gz: 37963d8ab0021e73ed0afe0c4f53146f95e341f6afce255e0394747888e54cb6
3
+ metadata.gz: 3ccbc0063defa6a784459e629b4dc402cdb7c35d7ca51bfbe371ac46210b6b59
4
+ data.tar.gz: c5c53dd9af2ea3ddb18ff390c9aa5a89370f6fecd068fba64ff425e5ea192d19
5
5
  SHA512:
6
- metadata.gz: 056c3e48e40d7e4f07bae0f4db9ce1b3216aa4850e06461880209d5fbbadb1e81a57e4990920bf331d95fe85bb5212210dc296a7f2fac4d142e193753af1e9e7
7
- data.tar.gz: e9304903feae90afd9109a48fc5fab1eee21346c99822aa52318414860d8e9763a96978d64ba11f0ab9ea39bb4922250174f6d712e11086e2bdd5d18928fbbcf
6
+ metadata.gz: be4016ed18b870b75821d2af83d30d79d1530b4f79125a042ccad4b67f9e578ec95313bcdfd2113a995c0281be917d14fe0a9b17200f5a8a15b9672f0b6ca146
7
+ data.tar.gz: 44898ccbbc5709310ee930c574d07fd4ea897c41934fbf631a401eabe7876145a8e4914d7e8b27d9525414ea112440f1a26e04409fbb3fcbddd08d6b8538ec44
data/ext/date/date_core.c CHANGED
@@ -11,6 +11,7 @@
11
11
  #include <sys/time.h>
12
12
  #endif
13
13
 
14
+ #undef NDEBUG
14
15
  #define NDEBUG
15
16
  #include <assert.h>
16
17
 
@@ -52,6 +53,8 @@ static double positive_inf, negative_inf;
52
53
  #define f_add3(x,y,z) f_add(f_add(x, y), z)
53
54
  #define f_sub3(x,y,z) f_sub(f_sub(x, y), z)
54
55
 
56
+ #define f_frozen_ary(...) rb_obj_freeze(rb_ary_new3(__VA_ARGS__))
57
+
55
58
  static VALUE date_initialize(int argc, VALUE *argv, VALUE self);
56
59
  static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self);
57
60
 
@@ -2970,11 +2973,15 @@ d_lite_memsize(const void *ptr)
2970
2973
  return complex_dat_p(dat) ? sizeof(struct ComplexDateData) : sizeof(struct SimpleDateData);
2971
2974
  }
2972
2975
 
2976
+ #ifndef HAVE_RB_EXT_RACTOR_SAFE
2977
+ # define RUBY_TYPED_FROZEN_SHAREABLE 0
2978
+ #endif
2979
+
2973
2980
  static const rb_data_type_t d_lite_type = {
2974
2981
  "Date",
2975
2982
  {d_lite_gc_mark, RUBY_TYPED_DEFAULT_FREE, d_lite_memsize,},
2976
2983
  0, 0,
2977
- RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED,
2984
+ RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED|RUBY_TYPED_FROZEN_SHAREABLE,
2978
2985
  };
2979
2986
 
2980
2987
  inline static VALUE
@@ -3766,89 +3773,89 @@ rt_complete_frags(VALUE klass, VALUE hash)
3766
3773
  VALUE k, a, d;
3767
3774
 
3768
3775
  if (NIL_P(tab)) {
3769
- tab = rb_ary_new3(11,
3770
- rb_ary_new3(2,
3776
+ tab = f_frozen_ary(11,
3777
+ f_frozen_ary(2,
3771
3778
  sym("time"),
3772
- rb_ary_new3(3,
3779
+ f_frozen_ary(3,
3773
3780
  sym("hour"),
3774
3781
  sym("min"),
3775
3782
  sym("sec"))),
3776
- rb_ary_new3(2,
3783
+ f_frozen_ary(2,
3777
3784
  Qnil,
3778
- rb_ary_new3(1,
3785
+ f_frozen_ary(1,
3779
3786
  sym("jd"))),
3780
- rb_ary_new3(2,
3787
+ f_frozen_ary(2,
3781
3788
  sym("ordinal"),
3782
- rb_ary_new3(5,
3789
+ f_frozen_ary(5,
3783
3790
  sym("year"),
3784
3791
  sym("yday"),
3785
3792
  sym("hour"),
3786
3793
  sym("min"),
3787
3794
  sym("sec"))),
3788
- rb_ary_new3(2,
3795
+ f_frozen_ary(2,
3789
3796
  sym("civil"),
3790
- rb_ary_new3(6,
3797
+ f_frozen_ary(6,
3791
3798
  sym("year"),
3792
3799
  sym("mon"),
3793
3800
  sym("mday"),
3794
3801
  sym("hour"),
3795
3802
  sym("min"),
3796
3803
  sym("sec"))),
3797
- rb_ary_new3(2,
3804
+ f_frozen_ary(2,
3798
3805
  sym("commercial"),
3799
- rb_ary_new3(6,
3806
+ f_frozen_ary(6,
3800
3807
  sym("cwyear"),
3801
3808
  sym("cweek"),
3802
3809
  sym("cwday"),
3803
3810
  sym("hour"),
3804
3811
  sym("min"),
3805
3812
  sym("sec"))),
3806
- rb_ary_new3(2,
3813
+ f_frozen_ary(2,
3807
3814
  sym("wday"),
3808
- rb_ary_new3(4,
3815
+ f_frozen_ary(4,
3809
3816
  sym("wday"),
3810
3817
  sym("hour"),
3811
3818
  sym("min"),
3812
3819
  sym("sec"))),
3813
- rb_ary_new3(2,
3820
+ f_frozen_ary(2,
3814
3821
  sym("wnum0"),
3815
- rb_ary_new3(6,
3822
+ f_frozen_ary(6,
3816
3823
  sym("year"),
3817
3824
  sym("wnum0"),
3818
3825
  sym("wday"),
3819
3826
  sym("hour"),
3820
3827
  sym("min"),
3821
3828
  sym("sec"))),
3822
- rb_ary_new3(2,
3829
+ f_frozen_ary(2,
3823
3830
  sym("wnum1"),
3824
- rb_ary_new3(6,
3831
+ f_frozen_ary(6,
3825
3832
  sym("year"),
3826
3833
  sym("wnum1"),
3827
3834
  sym("wday"),
3828
3835
  sym("hour"),
3829
3836
  sym("min"),
3830
3837
  sym("sec"))),
3831
- rb_ary_new3(2,
3838
+ f_frozen_ary(2,
3832
3839
  Qnil,
3833
- rb_ary_new3(6,
3840
+ f_frozen_ary(6,
3834
3841
  sym("cwyear"),
3835
3842
  sym("cweek"),
3836
3843
  sym("wday"),
3837
3844
  sym("hour"),
3838
3845
  sym("min"),
3839
3846
  sym("sec"))),
3840
- rb_ary_new3(2,
3847
+ f_frozen_ary(2,
3841
3848
  Qnil,
3842
- rb_ary_new3(6,
3849
+ f_frozen_ary(6,
3843
3850
  sym("year"),
3844
3851
  sym("wnum0"),
3845
3852
  sym("cwday"),
3846
3853
  sym("hour"),
3847
3854
  sym("min"),
3848
3855
  sym("sec"))),
3849
- rb_ary_new3(2,
3856
+ f_frozen_ary(2,
3850
3857
  Qnil,
3851
- rb_ary_new3(6,
3858
+ f_frozen_ary(6,
3852
3859
  sym("year"),
3853
3860
  sym("wnum1"),
3854
3861
  sym("cwday"),
@@ -4344,8 +4351,12 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
4344
4351
  * Date._parse(string[, comp=true]) -> hash
4345
4352
  *
4346
4353
  * Parses the given representation of date and time, and returns a
4347
- * hash of parsed elements. This method does not function as a
4348
- * validator.
4354
+ * hash of parsed elements.
4355
+ *
4356
+ * This method *does not* function as a validator. If the input
4357
+ * string does not match valid formats strictly, you may get a cryptic
4358
+ * result. Should consider to use `Date._strptime` or
4359
+ * `DateTime._strptime` instead of this method as possible.
4349
4360
  *
4350
4361
  * If the optional second argument is true and the detected year is in
4351
4362
  * the range "00" to "99", considers the year a 2-digit form and makes
@@ -4364,7 +4375,12 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
4364
4375
  * Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date
4365
4376
  *
4366
4377
  * Parses the given representation of date and time, and creates a
4367
- * date object. This method does not function as a validator.
4378
+ * date object.
4379
+ *
4380
+ * This method *does not* function as a validator. If the input
4381
+ * string does not match valid formats strictly, you may get a cryptic
4382
+ * result. Should consider to use `Date.strptime` instead of this
4383
+ * method as possible.
4368
4384
  *
4369
4385
  * If the optional second argument is true and the detected year is in
4370
4386
  * the range "00" to "99", considers the year a 2-digit form and makes
@@ -6884,7 +6900,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
6884
6900
  * %c - date and time (%a %b %e %T %Y)
6885
6901
  * %D - Date (%m/%d/%y)
6886
6902
  * %F - The ISO 8601 date format (%Y-%m-%d)
6887
- * %v - VMS date (%e-%b-%Y)
6903
+ * %v - VMS date (%e-%^b-%Y)
6888
6904
  * %x - Same as %D
6889
6905
  * %X - Same as %T
6890
6906
  * %r - 12-hour time (%I:%M:%S %p)
@@ -7201,11 +7217,14 @@ d_lite_marshal_load(VALUE self, VALUE a)
7201
7217
 
7202
7218
  if (simple_dat_p(dat)) {
7203
7219
  if (df || !f_zero_p(sf) || of) {
7204
- rb_raise(rb_eArgError,
7205
- "cannot load complex into simple");
7220
+ /* loading a fractional date; promote to complex */
7221
+ dat = ruby_xrealloc(dat, sizeof(struct ComplexDateData));
7222
+ RTYPEDDATA(self)->data = dat;
7223
+ goto complex_data;
7206
7224
  }
7207
7225
  set_to_simple(self, &dat->s, nth, jd, sg, 0, 0, 0, HAVE_JD);
7208
7226
  } else {
7227
+ complex_data:
7209
7228
  set_to_complex(self, &dat->c, nth, jd, df, sf, of, sg,
7210
7229
  0, 0, 0, 0, 0, 0,
7211
7230
  HAVE_JD | HAVE_DF);
@@ -7778,7 +7797,7 @@ datetime_s_now(int argc, VALUE *argv, VALUE klass)
7778
7797
  #ifdef HAVE_STRUCT_TM_TM_GMTOFF
7779
7798
  of = tm.tm_gmtoff;
7780
7799
  #elif defined(HAVE_TIMEZONE)
7781
- #ifdef HAVE_ALTZONE
7800
+ #if defined(HAVE_ALTZONE) && !defined(_AIX)
7782
7801
  of = (long)-((tm.tm_isdst > 0) ? altzone : timezone);
7783
7802
  #else
7784
7803
  of = (long)-timezone;
@@ -7997,7 +8016,12 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
7997
8016
  * DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]) -> datetime
7998
8017
  *
7999
8018
  * Parses the given representation of date and time, and creates a
8000
- * DateTime object. This method does not function as a validator.
8019
+ * DateTime object.
8020
+ *
8021
+ * This method *does not* function as a validator. If the input
8022
+ * string does not match valid formats strictly, you may get a cryptic
8023
+ * result. Should consider to use `DateTime.strptime` instead of this
8024
+ * method as possible.
8001
8025
  *
8002
8026
  * If the optional second argument is true and the detected year is in
8003
8027
  * the range "00" to "99", makes it full.
@@ -8356,7 +8380,7 @@ dt_lite_to_s(VALUE self)
8356
8380
  * %c - date and time (%a %b %e %T %Y)
8357
8381
  * %D - Date (%m/%d/%y)
8358
8382
  * %F - The ISO 8601 date format (%Y-%m-%d)
8359
- * %v - VMS date (%e-%b-%Y)
8383
+ * %v - VMS date (%e-%^b-%Y)
8360
8384
  * %x - Same as %D
8361
8385
  * %X - Same as %T
8362
8386
  * %r - 12-hour time (%I:%M:%S %p)
@@ -9098,13 +9122,13 @@ d_lite_zero(VALUE x)
9098
9122
  void
9099
9123
  Init_date_core(void)
9100
9124
  {
9101
- #undef rb_intern
9102
- #define rb_intern(str) rb_intern_const(str)
9103
-
9104
- id_cmp = rb_intern("<=>");
9105
- id_le_p = rb_intern("<=");
9106
- id_ge_p = rb_intern(">=");
9107
- id_eqeq_p = rb_intern("==");
9125
+ #ifdef HAVE_RB_EXT_RACTOR_SAFE
9126
+ RB_EXT_RACTOR_SAFE(true);
9127
+ #endif
9128
+ id_cmp = rb_intern_const("<=>");
9129
+ id_le_p = rb_intern_const("<=");
9130
+ id_ge_p = rb_intern_const(">=");
9131
+ id_eqeq_p = rb_intern_const("==");
9108
9132
 
9109
9133
  half_days_in_day = rb_rational_new2(INT2FIX(1), INT2FIX(2));
9110
9134
 
@@ -9511,6 +9535,8 @@ Init_date_core(void)
9511
9535
  * A subclass of Date that easily handles date, hour, minute, second,
9512
9536
  * and offset.
9513
9537
  *
9538
+ * DateTime class is considered deprecated. Use Time class.
9539
+ *
9514
9540
  * DateTime does not consider any leap seconds, does not track
9515
9541
  * any summer time rules.
9516
9542
  *
@@ -9571,18 +9597,18 @@ Init_date_core(void)
9571
9597
  * === When should you use DateTime and when should you use Time?
9572
9598
  *
9573
9599
  * It's a common misconception that
9574
- * {William Shakespeare}[http://en.wikipedia.org/wiki/William_Shakespeare]
9600
+ * {William Shakespeare}[https://en.wikipedia.org/wiki/William_Shakespeare]
9575
9601
  * and
9576
- * {Miguel de Cervantes}[http://en.wikipedia.org/wiki/Miguel_de_Cervantes]
9602
+ * {Miguel de Cervantes}[https://en.wikipedia.org/wiki/Miguel_de_Cervantes]
9577
9603
  * died on the same day in history -
9578
9604
  * so much so that UNESCO named April 23 as
9579
- * {World Book Day because of this fact}[http://en.wikipedia.org/wiki/World_Book_Day].
9605
+ * {World Book Day because of this fact}[https://en.wikipedia.org/wiki/World_Book_Day].
9580
9606
  * However, because England hadn't yet adopted the
9581
- * {Gregorian Calendar Reform}[http://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform]
9582
- * (and wouldn't until {1752}[http://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750])
9607
+ * {Gregorian Calendar Reform}[https://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform]
9608
+ * (and wouldn't until {1752}[https://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750])
9583
9609
  * their deaths are actually 10 days apart.
9584
9610
  * Since Ruby's Time class implements a
9585
- * {proleptic Gregorian calendar}[http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar]
9611
+ * {proleptic Gregorian calendar}[https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar]
9586
9612
  * and has no concept of calendar reform there's no way
9587
9613
  * to express this with Time objects. This is where DateTime steps in:
9588
9614
  *
@@ -9626,7 +9652,7 @@ Init_date_core(void)
9626
9652
  * #=> Fri, 04 May 1753 00:00:00 +0000
9627
9653
  *
9628
9654
  * As you can see, if we're accurately tracking the number of
9629
- * {solar years}[http://en.wikipedia.org/wiki/Tropical_year]
9655
+ * {solar years}[https://en.wikipedia.org/wiki/Tropical_year]
9630
9656
  * since Shakespeare's birthday then the correct anniversary date
9631
9657
  * would be the 4th May and not the 23rd April.
9632
9658
  *
@@ -9638,10 +9664,10 @@ Init_date_core(void)
9638
9664
  * making the same mistakes as UNESCO. If you also have to deal
9639
9665
  * with timezones then best of luck - just bear in mind that
9640
9666
  * you'll probably be dealing with
9641
- * {local solar times}[http://en.wikipedia.org/wiki/Solar_time],
9667
+ * {local solar times}[https://en.wikipedia.org/wiki/Solar_time],
9642
9668
  * since it wasn't until the 19th century that the introduction
9643
9669
  * of the railways necessitated the need for
9644
- * {Standard Time}[http://en.wikipedia.org/wiki/Standard_time#Great_Britain]
9670
+ * {Standard Time}[https://en.wikipedia.org/wiki/Standard_time#Great_Britain]
9645
9671
  * and eventually timezones.
9646
9672
  */
9647
9673
 
@@ -70,7 +70,7 @@ static size_t
70
70
  digit_span(const char *s, const char *e)
71
71
  {
72
72
  size_t i = 0;
73
- while (s + i < e && isdigit(s[i])) i++;
73
+ while (s + i < e && isdigit((unsigned char)s[i])) i++;
74
74
  return i;
75
75
  }
76
76
 
@@ -110,7 +110,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
110
110
 
111
111
  s = RSTRING_PTR(y);
112
112
  ep = RSTRING_END(y);
113
- while (s < ep && !issign(*s) && !isdigit(*s))
113
+ while (s < ep && !issign(*s) && !isdigit((unsigned char)*s))
114
114
  s++;
115
115
  if (s >= ep) goto no_date;
116
116
  bp = s;
@@ -162,7 +162,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
162
162
 
163
163
  s = RSTRING_PTR(y);
164
164
  ep = RSTRING_END(y);
165
- while (s < ep && !issign(*s) && !isdigit(*s))
165
+ while (s < ep && !issign(*s) && !isdigit((unsigned char)*s))
166
166
  s++;
167
167
  if (s >= ep) goto no_year;
168
168
  bp = s;
@@ -199,7 +199,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
199
199
 
200
200
  s = RSTRING_PTR(m);
201
201
  ep = RSTRING_END(m);
202
- while (s < ep && !isdigit(*s))
202
+ while (s < ep && !isdigit((unsigned char)*s))
203
203
  s++;
204
204
  if (s >= ep) goto no_month;
205
205
  bp = s;
@@ -225,7 +225,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
225
225
 
226
226
  s = RSTRING_PTR(d);
227
227
  ep = RSTRING_END(d);
228
- while (s < ep && !isdigit(*s))
228
+ while (s < ep && !isdigit((unsigned char)*s))
229
229
  s++;
230
230
  if (s >= ep) goto no_mday;
231
231
  bp = s;
@@ -276,6 +276,7 @@ regcomp(const char *source, long len, int opt)
276
276
  VALUE pat;
277
277
 
278
278
  pat = rb_reg_new(source, len, opt);
279
+ rb_obj_freeze(pat);
279
280
  rb_gc_register_mark_object(pat);
280
281
  return pat;
281
282
  }
@@ -364,9 +365,9 @@ static int
364
365
  str_end_with_word(const char *s, long l, const char *w)
365
366
  {
366
367
  int n = (int)strlen(w);
367
- if (l <= n || !isspace(s[l - n - 1])) return 0;
368
+ if (l <= n || !isspace((unsigned char)s[l - n - 1])) return 0;
368
369
  if (strncasecmp(&s[l - n], w, n)) return 0;
369
- do ++n; while (l > n && isspace(s[l - n - 1]));
370
+ do ++n; while (l > n && isspace((unsigned char)s[l - n - 1]));
370
371
  return n;
371
372
  }
372
373
 
@@ -376,7 +377,7 @@ shrunk_size(const char *s, long l)
376
377
  long i, ni;
377
378
  int sp = 0;
378
379
  for (i = ni = 0; i < l; ++i) {
379
- if (!isspace(s[i])) {
380
+ if (!isspace((unsigned char)s[i])) {
380
381
  if (sp) ni++;
381
382
  sp = 0;
382
383
  ni++;
@@ -394,7 +395,7 @@ shrink_space(char *d, const char *s, long l)
394
395
  long i, ni;
395
396
  int sp = 0;
396
397
  for (i = ni = 0; i < l; ++i) {
397
- if (!isspace(s[i])) {
398
+ if (!isspace((unsigned char)s[i])) {
398
399
  if (sp) d[ni++] = ' ';
399
400
  sp = 0;
400
401
  d[ni++] = s[i];
@@ -754,8 +755,8 @@ check_year_width(VALUE y)
754
755
  l = RSTRING_LEN(y);
755
756
  if (l < 2) return 0;
756
757
  s = RSTRING_PTR(y);
757
- if (!isdigit(s[1])) return 0;
758
- return (l == 2 || !isdigit(s[2]));
758
+ if (!isdigit((unsigned char)s[1])) return 0;
759
+ return (l == 2 || !isdigit((unsigned char)s[2]));
759
760
  }
760
761
 
761
762
  static int
@@ -393,7 +393,7 @@ date_strftime_with_tmx(char *s, const size_t maxsize, const char *format,
393
393
  continue;
394
394
 
395
395
  case 'v':
396
- STRFTIME("%e-%b-%Y");
396
+ STRFTIME("%e-%^b-%Y");
397
397
  continue;
398
398
 
399
399
  case 'w': /* weekday, Sunday == 0, 0 - 6 */
@@ -581,6 +581,7 @@ date__strptime_internal(const char *str, size_t slen,
581
581
  if (NIL_P(pat)) {
582
582
  pat = rb_reg_new(pat_source, sizeof pat_source - 1,
583
583
  ONIG_OPTION_IGNORECASE);
584
+ rb_obj_freeze(pat);
584
585
  rb_gc_register_mark_object(pat);
585
586
  }
586
587
 
data/ext/date/extconf.rb CHANGED
@@ -3,7 +3,9 @@ require 'mkmf'
3
3
 
4
4
  config_string("strict_warnflags") {|w| $warnflags += " #{w}"}
5
5
 
6
- have_var("timezone", "time.h")
7
- have_var("altzone", "time.h")
6
+ with_werror("", {:werror => true}) do |opt, |
7
+ have_var("timezone", "time.h", opt)
8
+ have_var("altzone", "time.h", opt)
9
+ end
8
10
 
9
11
  create_makefile('date_core')
data/ext/date/prereq.mk CHANGED
@@ -9,4 +9,11 @@ zonetab.h: zonetab.list
9
9
 
10
10
  .PHONY: update-zonetab
11
11
  update-zonetab:
12
- $(RUBY) -C $(srcdir) update-abbr.rb
12
+ $(RUBY) -C $(srcdir) update-abbr
13
+
14
+ .PHONY: update-nothing
15
+ update-nothing:
16
+
17
+ update = nothing
18
+
19
+ zonetab.list: update-$(update)
data/ext/date/zonetab.h CHANGED
@@ -846,7 +846,7 @@ zonetab (register const char *str, register size_t len)
846
846
  {gperf_offsetof(stringpool, 22), 3*3600},
847
847
  {-1},
848
848
  #line 101 "zonetab.list"
849
- {gperf_offsetof(stringpool, 24),10*3600},
849
+ {gperf_offsetof(stringpool, 24),-6*3600},
850
850
  #line 217 "zonetab.list"
851
851
  {gperf_offsetof(stringpool, 25),-18000},
852
852
  #line 19 "zonetab.list"
@@ -875,7 +875,7 @@ zonetab (register const char *str, register size_t len)
875
875
  #line 79 "zonetab.list"
876
876
  {gperf_offsetof(stringpool, 38), 2*3600},
877
877
  #line 65 "zonetab.list"
878
- {gperf_offsetof(stringpool, 39),-10*3600},
878
+ {gperf_offsetof(stringpool, 39),2*3600},
879
879
  {-1},
880
880
  #line 202 "zonetab.list"
881
881
  {gperf_offsetof(stringpool, 41),28800},
@@ -998,7 +998,7 @@ zonetab (register const char *str, register size_t len)
998
998
  #line 148 "zonetab.list"
999
999
  {gperf_offsetof(stringpool, 107), -25200},
1000
1000
  #line 96 "zonetab.list"
1001
- {gperf_offsetof(stringpool, 108), 8*3600},
1001
+ {gperf_offsetof(stringpool, 108), (6*3600+1800)},
1002
1002
  #line 42 "zonetab.list"
1003
1003
  {gperf_offsetof(stringpool, 109), -10*3600},
1004
1004
  #line 31 "zonetab.list"
@@ -1017,11 +1017,11 @@ zonetab (register const char *str, register size_t len)
1017
1017
  {gperf_offsetof(stringpool, 117), 1*3600},
1018
1018
  {-1},
1019
1019
  #line 95 "zonetab.list"
1020
- {gperf_offsetof(stringpool, 119), 7*3600},
1020
+ {gperf_offsetof(stringpool, 119), 2*3600},
1021
1021
  #line 313 "zonetab.list"
1022
1022
  {gperf_offsetof(stringpool, 120),43200},
1023
1023
  #line 55 "zonetab.list"
1024
- {gperf_offsetof(stringpool, 121), -(3*3600+1800)},
1024
+ {gperf_offsetof(stringpool, 121), -(2*3600+1800)},
1025
1025
  #line 184 "zonetab.list"
1026
1026
  {gperf_offsetof(stringpool, 122),31500},
1027
1027
  #line 204 "zonetab.list"
@@ -1168,7 +1168,7 @@ zonetab (register const char *str, register size_t len)
1168
1168
  #line 299 "zonetab.list"
1169
1169
  {gperf_offsetof(stringpool, 206),50400},
1170
1170
  #line 85 "zonetab.list"
1171
- {gperf_offsetof(stringpool, 207), 2*3600},
1171
+ {gperf_offsetof(stringpool, 207), -11*3600},
1172
1172
  {-1},
1173
1173
  #line 142 "zonetab.list"
1174
1174
  {gperf_offsetof(stringpool, 209), 19800},
@@ -1371,7 +1371,7 @@ zonetab (register const char *str, register size_t len)
1371
1371
  {gperf_offsetof(stringpool, 324), 8*3600},
1372
1372
  {-1},
1373
1373
  #line 50 "zonetab.list"
1374
- {gperf_offsetof(stringpool, 326), -(2*3600+1800)},
1374
+ {gperf_offsetof(stringpool, 326), -(1*3600+1800)},
1375
1375
  #line 285 "zonetab.list"
1376
1376
  {gperf_offsetof(stringpool, 327),-10800},
1377
1377
  {-1}, {-1},
@@ -47,12 +47,12 @@ utc, 0*3600
47
47
  wet, 0*3600
48
48
  at, -2*3600
49
49
  brst,-2*3600
50
- ndt, -(2*3600+1800)
50
+ ndt, -(1*3600+1800)
51
51
  art, -3*3600
52
52
  adt, -3*3600
53
53
  brt, -3*3600
54
54
  clst,-3*3600
55
- nst, -(3*3600+1800)
55
+ nst, -(2*3600+1800)
56
56
  ast, -4*3600
57
57
  clt, -4*3600
58
58
  akdt,-8*3600
@@ -62,7 +62,7 @@ hadt,-9*3600
62
62
  hdt, -9*3600
63
63
  yst, -9*3600
64
64
  ahst,-10*3600
65
- cat,-10*3600
65
+ cat,2*3600
66
66
  hast,-10*3600
67
67
  hst,-10*3600
68
68
  nt, -11*3600
@@ -82,7 +82,7 @@ fst, 2*3600
82
82
  mest, 2*3600
83
83
  mesz, 2*3600
84
84
  sast, 2*3600
85
- sst, 2*3600
85
+ sst, -11*3600
86
86
  bt, 3*3600
87
87
  eat, 3*3600
88
88
  eest, 3*3600
@@ -92,13 +92,13 @@ zp4, 4*3600
92
92
  zp5, 5*3600
93
93
  ist, (5*3600+1800)
94
94
  zp6, 6*3600
95
- wast, 7*3600
96
- cct, 8*3600
95
+ wast, 2*3600
96
+ cct, (6*3600+1800)
97
97
  sgt, 8*3600
98
98
  wadt, 8*3600
99
99
  jst, 9*3600
100
100
  kst, 9*3600
101
- east,10*3600
101
+ east,-6*3600
102
102
  gst, 10*3600
103
103
  eadt,11*3600
104
104
  idle,12*3600
data/lib/date.rb CHANGED
@@ -11,8 +11,6 @@ class Date
11
11
 
12
12
  class Infinity < Numeric # :nodoc:
13
13
 
14
- include Comparable
15
-
16
14
  def initialize(d=1) @d = d <=> 0 end
17
15
 
18
16
  def d() @d end
@@ -32,6 +30,8 @@ class Date
32
30
  def <=>(other)
33
31
  case other
34
32
  when Infinity; return d <=> other.d
33
+ when Float::INFINITY; return d <=> 1
34
+ when -Float::INFINITY; return d <=> -1
35
35
  when Numeric; return d
36
36
  else
37
37
  begin
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tadayoshi Funaba
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-30 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A subclass of Object includes Comparable module for handling dates.
14
14
  email:
15
- -
15
+ -
16
16
  executables: []
17
17
  extensions:
18
18
  - ext/date/extconf.rb
@@ -30,9 +30,10 @@ files:
30
30
  - lib/date.rb
31
31
  homepage: https://github.com/ruby/date
32
32
  licenses:
33
+ - Ruby
33
34
  - BSD-2-Clause
34
35
  metadata: {}
35
- post_install_message:
36
+ post_install_message:
36
37
  rdoc_options: []
37
38
  require_paths:
38
39
  - lib
@@ -47,8 +48,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
48
  - !ruby/object:Gem::Version
48
49
  version: '0'
49
50
  requirements: []
50
- rubygems_version: 3.0.3
51
- signing_key:
51
+ rubygems_version: 3.2.22
52
+ signing_key:
52
53
  specification_version: 4
53
54
  summary: A subclass of Object includes Comparable module for handling dates.
54
55
  test_files: []