date 3.0.3 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/date/date_core.c +66 -44
- data/ext/date/date_parse.c +1 -0
- data/ext/date/date_strptime.c +1 -0
- data/ext/date/prereq.mk +1 -1
- data/ext/date/zonetab.list +7 -7
- data/lib/date.rb +1 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ddb4e0b03782fac8cd04d3a56c721e602bc2a095c4473a5d15edb83b82428c7
|
4
|
+
data.tar.gz: 40e9c5995f3d0270e1407304559f749bfb537b712f0a3796539fb0c7140f3790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c92038d2b0074ee5d7bd7b2cff52841a80847a489bcf61adc0bcefa3fe0b7f7408bd76216c6418b351a827b5e5c2cbe63aea8af394894b7bd40001af93fc4f0f
|
7
|
+
data.tar.gz: 6dfef0f8e5927fd45f7222bab46619000fec7c66482998141e76d1792b5c5babb366576df8bd2a7fcfcd94ea873bd745ef32491bebb7495c211358cd21c6ec2f
|
data/ext/date/date_core.c
CHANGED
@@ -53,6 +53,8 @@ static double positive_inf, negative_inf;
|
|
53
53
|
#define f_add3(x,y,z) f_add(f_add(x, y), z)
|
54
54
|
#define f_sub3(x,y,z) f_sub(f_sub(x, y), z)
|
55
55
|
|
56
|
+
#define f_frozen_ary(...) rb_obj_freeze(rb_ary_new3(__VA_ARGS__))
|
57
|
+
|
56
58
|
static VALUE date_initialize(int argc, VALUE *argv, VALUE self);
|
57
59
|
static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self);
|
58
60
|
|
@@ -2971,11 +2973,15 @@ d_lite_memsize(const void *ptr)
|
|
2971
2973
|
return complex_dat_p(dat) ? sizeof(struct ComplexDateData) : sizeof(struct SimpleDateData);
|
2972
2974
|
}
|
2973
2975
|
|
2976
|
+
#ifndef HAVE_RB_EXT_RACTOR_SAFE
|
2977
|
+
# define RUBY_TYPED_FROZEN_SHAREABLE 0
|
2978
|
+
#endif
|
2979
|
+
|
2974
2980
|
static const rb_data_type_t d_lite_type = {
|
2975
2981
|
"Date",
|
2976
2982
|
{d_lite_gc_mark, RUBY_TYPED_DEFAULT_FREE, d_lite_memsize,},
|
2977
2983
|
0, 0,
|
2978
|
-
RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED,
|
2984
|
+
RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED|RUBY_TYPED_FROZEN_SHAREABLE,
|
2979
2985
|
};
|
2980
2986
|
|
2981
2987
|
inline static VALUE
|
@@ -3767,89 +3773,89 @@ rt_complete_frags(VALUE klass, VALUE hash)
|
|
3767
3773
|
VALUE k, a, d;
|
3768
3774
|
|
3769
3775
|
if (NIL_P(tab)) {
|
3770
|
-
tab =
|
3771
|
-
|
3776
|
+
tab = f_frozen_ary(11,
|
3777
|
+
f_frozen_ary(2,
|
3772
3778
|
sym("time"),
|
3773
|
-
|
3779
|
+
f_frozen_ary(3,
|
3774
3780
|
sym("hour"),
|
3775
3781
|
sym("min"),
|
3776
3782
|
sym("sec"))),
|
3777
|
-
|
3783
|
+
f_frozen_ary(2,
|
3778
3784
|
Qnil,
|
3779
|
-
|
3785
|
+
f_frozen_ary(1,
|
3780
3786
|
sym("jd"))),
|
3781
|
-
|
3787
|
+
f_frozen_ary(2,
|
3782
3788
|
sym("ordinal"),
|
3783
|
-
|
3789
|
+
f_frozen_ary(5,
|
3784
3790
|
sym("year"),
|
3785
3791
|
sym("yday"),
|
3786
3792
|
sym("hour"),
|
3787
3793
|
sym("min"),
|
3788
3794
|
sym("sec"))),
|
3789
|
-
|
3795
|
+
f_frozen_ary(2,
|
3790
3796
|
sym("civil"),
|
3791
|
-
|
3797
|
+
f_frozen_ary(6,
|
3792
3798
|
sym("year"),
|
3793
3799
|
sym("mon"),
|
3794
3800
|
sym("mday"),
|
3795
3801
|
sym("hour"),
|
3796
3802
|
sym("min"),
|
3797
3803
|
sym("sec"))),
|
3798
|
-
|
3804
|
+
f_frozen_ary(2,
|
3799
3805
|
sym("commercial"),
|
3800
|
-
|
3806
|
+
f_frozen_ary(6,
|
3801
3807
|
sym("cwyear"),
|
3802
3808
|
sym("cweek"),
|
3803
3809
|
sym("cwday"),
|
3804
3810
|
sym("hour"),
|
3805
3811
|
sym("min"),
|
3806
3812
|
sym("sec"))),
|
3807
|
-
|
3813
|
+
f_frozen_ary(2,
|
3808
3814
|
sym("wday"),
|
3809
|
-
|
3815
|
+
f_frozen_ary(4,
|
3810
3816
|
sym("wday"),
|
3811
3817
|
sym("hour"),
|
3812
3818
|
sym("min"),
|
3813
3819
|
sym("sec"))),
|
3814
|
-
|
3820
|
+
f_frozen_ary(2,
|
3815
3821
|
sym("wnum0"),
|
3816
|
-
|
3822
|
+
f_frozen_ary(6,
|
3817
3823
|
sym("year"),
|
3818
3824
|
sym("wnum0"),
|
3819
3825
|
sym("wday"),
|
3820
3826
|
sym("hour"),
|
3821
3827
|
sym("min"),
|
3822
3828
|
sym("sec"))),
|
3823
|
-
|
3829
|
+
f_frozen_ary(2,
|
3824
3830
|
sym("wnum1"),
|
3825
|
-
|
3831
|
+
f_frozen_ary(6,
|
3826
3832
|
sym("year"),
|
3827
3833
|
sym("wnum1"),
|
3828
3834
|
sym("wday"),
|
3829
3835
|
sym("hour"),
|
3830
3836
|
sym("min"),
|
3831
3837
|
sym("sec"))),
|
3832
|
-
|
3838
|
+
f_frozen_ary(2,
|
3833
3839
|
Qnil,
|
3834
|
-
|
3840
|
+
f_frozen_ary(6,
|
3835
3841
|
sym("cwyear"),
|
3836
3842
|
sym("cweek"),
|
3837
3843
|
sym("wday"),
|
3838
3844
|
sym("hour"),
|
3839
3845
|
sym("min"),
|
3840
3846
|
sym("sec"))),
|
3841
|
-
|
3847
|
+
f_frozen_ary(2,
|
3842
3848
|
Qnil,
|
3843
|
-
|
3849
|
+
f_frozen_ary(6,
|
3844
3850
|
sym("year"),
|
3845
3851
|
sym("wnum0"),
|
3846
3852
|
sym("cwday"),
|
3847
3853
|
sym("hour"),
|
3848
3854
|
sym("min"),
|
3849
3855
|
sym("sec"))),
|
3850
|
-
|
3856
|
+
f_frozen_ary(2,
|
3851
3857
|
Qnil,
|
3852
|
-
|
3858
|
+
f_frozen_ary(6,
|
3853
3859
|
sym("year"),
|
3854
3860
|
sym("wnum1"),
|
3855
3861
|
sym("cwday"),
|
@@ -4373,8 +4379,12 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
|
4373
4379
|
* Date._parse(string[, comp=true], limit: 128) -> hash
|
4374
4380
|
*
|
4375
4381
|
* Parses the given representation of date and time, and returns a
|
4376
|
-
* hash of parsed elements.
|
4377
|
-
*
|
4382
|
+
* hash of parsed elements.
|
4383
|
+
*
|
4384
|
+
* This method **does not** function as a validator. If the input
|
4385
|
+
* string does not match valid formats strictly, you may get a cryptic
|
4386
|
+
* result. Should consider to use `Date._strptime` or
|
4387
|
+
* `DateTime._strptime` instead of this method as possible.
|
4378
4388
|
*
|
4379
4389
|
* If the optional second argument is true and the detected year is in
|
4380
4390
|
* the range "00" to "99", considers the year a 2-digit form and makes
|
@@ -4397,7 +4407,12 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
|
|
4397
4407
|
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]], limit: 128) -> date
|
4398
4408
|
*
|
4399
4409
|
* Parses the given representation of date and time, and creates a
|
4400
|
-
* date object.
|
4410
|
+
* date object.
|
4411
|
+
*
|
4412
|
+
* This method **does not** function as a validator. If the input
|
4413
|
+
* string does not match valid formats strictly, you may get a cryptic
|
4414
|
+
* result. Should consider to use `Date.strptime` instead of this
|
4415
|
+
* method as possible.
|
4401
4416
|
*
|
4402
4417
|
* If the optional second argument is true and the detected year is in
|
4403
4418
|
* the range "00" to "99", considers the year a 2-digit form and makes
|
@@ -8145,7 +8160,12 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
8145
8160
|
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]], limit: 128) -> datetime
|
8146
8161
|
*
|
8147
8162
|
* Parses the given representation of date and time, and creates a
|
8148
|
-
* DateTime object.
|
8163
|
+
* DateTime object.
|
8164
|
+
*
|
8165
|
+
* This method **does not** function as a validator. If the input
|
8166
|
+
* string does not match valid formats strictly, you may get a cryptic
|
8167
|
+
* result. Should consider to use `DateTime.strptime` instead of this
|
8168
|
+
* method as possible.
|
8149
8169
|
*
|
8150
8170
|
* If the optional second argument is true and the detected year is in
|
8151
8171
|
* the range "00" to "99", makes it full.
|
@@ -9313,13 +9333,13 @@ d_lite_zero(VALUE x)
|
|
9313
9333
|
void
|
9314
9334
|
Init_date_core(void)
|
9315
9335
|
{
|
9316
|
-
#
|
9317
|
-
|
9318
|
-
|
9319
|
-
id_cmp =
|
9320
|
-
id_le_p =
|
9321
|
-
id_ge_p =
|
9322
|
-
id_eqeq_p =
|
9336
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
9337
|
+
RB_EXT_RACTOR_SAFE(true);
|
9338
|
+
#endif
|
9339
|
+
id_cmp = rb_intern_const("<=>");
|
9340
|
+
id_le_p = rb_intern_const("<=");
|
9341
|
+
id_ge_p = rb_intern_const(">=");
|
9342
|
+
id_eqeq_p = rb_intern_const("==");
|
9323
9343
|
|
9324
9344
|
half_days_in_day = rb_rational_new2(INT2FIX(1), INT2FIX(2));
|
9325
9345
|
|
@@ -9726,6 +9746,8 @@ Init_date_core(void)
|
|
9726
9746
|
* A subclass of Date that easily handles date, hour, minute, second,
|
9727
9747
|
* and offset.
|
9728
9748
|
*
|
9749
|
+
* DateTime class is considered deprecated. Use Time class.
|
9750
|
+
*
|
9729
9751
|
* DateTime does not consider any leap seconds, does not track
|
9730
9752
|
* any summer time rules.
|
9731
9753
|
*
|
@@ -9786,18 +9808,18 @@ Init_date_core(void)
|
|
9786
9808
|
* === When should you use DateTime and when should you use Time?
|
9787
9809
|
*
|
9788
9810
|
* It's a common misconception that
|
9789
|
-
* {William Shakespeare}[
|
9811
|
+
* {William Shakespeare}[https://en.wikipedia.org/wiki/William_Shakespeare]
|
9790
9812
|
* and
|
9791
|
-
* {Miguel de Cervantes}[
|
9813
|
+
* {Miguel de Cervantes}[https://en.wikipedia.org/wiki/Miguel_de_Cervantes]
|
9792
9814
|
* died on the same day in history -
|
9793
9815
|
* so much so that UNESCO named April 23 as
|
9794
|
-
* {World Book Day because of this fact}[
|
9816
|
+
* {World Book Day because of this fact}[https://en.wikipedia.org/wiki/World_Book_Day].
|
9795
9817
|
* However, because England hadn't yet adopted the
|
9796
|
-
* {Gregorian Calendar Reform}[
|
9797
|
-
* (and wouldn't until {1752}[
|
9818
|
+
* {Gregorian Calendar Reform}[https://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform]
|
9819
|
+
* (and wouldn't until {1752}[https://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750])
|
9798
9820
|
* their deaths are actually 10 days apart.
|
9799
9821
|
* Since Ruby's Time class implements a
|
9800
|
-
* {proleptic Gregorian calendar}[
|
9822
|
+
* {proleptic Gregorian calendar}[https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar]
|
9801
9823
|
* and has no concept of calendar reform there's no way
|
9802
9824
|
* to express this with Time objects. This is where DateTime steps in:
|
9803
9825
|
*
|
@@ -9841,7 +9863,7 @@ Init_date_core(void)
|
|
9841
9863
|
* #=> Fri, 04 May 1753 00:00:00 +0000
|
9842
9864
|
*
|
9843
9865
|
* As you can see, if we're accurately tracking the number of
|
9844
|
-
* {solar years}[
|
9866
|
+
* {solar years}[https://en.wikipedia.org/wiki/Tropical_year]
|
9845
9867
|
* since Shakespeare's birthday then the correct anniversary date
|
9846
9868
|
* would be the 4th May and not the 23rd April.
|
9847
9869
|
*
|
@@ -9853,10 +9875,10 @@ Init_date_core(void)
|
|
9853
9875
|
* making the same mistakes as UNESCO. If you also have to deal
|
9854
9876
|
* with timezones then best of luck - just bear in mind that
|
9855
9877
|
* you'll probably be dealing with
|
9856
|
-
* {local solar times}[
|
9878
|
+
* {local solar times}[https://en.wikipedia.org/wiki/Solar_time],
|
9857
9879
|
* since it wasn't until the 19th century that the introduction
|
9858
9880
|
* of the railways necessitated the need for
|
9859
|
-
* {Standard Time}[
|
9881
|
+
* {Standard Time}[https://en.wikipedia.org/wiki/Standard_time#Great_Britain]
|
9860
9882
|
* and eventually timezones.
|
9861
9883
|
*/
|
9862
9884
|
|
data/ext/date/date_parse.c
CHANGED
data/ext/date/date_strptime.c
CHANGED
data/ext/date/prereq.mk
CHANGED
data/ext/date/zonetab.list
CHANGED
@@ -47,12 +47,12 @@ utc, 0*3600
|
|
47
47
|
wet, 0*3600
|
48
48
|
at, -2*3600
|
49
49
|
brst,-2*3600
|
50
|
-
ndt, -(
|
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, -(
|
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
|
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,
|
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,
|
96
|
-
cct,
|
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
|
101
|
+
east,-6*3600
|
102
102
|
gst, 10*3600
|
103
103
|
eadt,11*3600
|
104
104
|
idle,12*3600
|
data/lib/date.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'date_core'
|
5
5
|
|
6
6
|
class Date
|
7
|
-
VERSION = '3.
|
7
|
+
VERSION = '3.1.3' # :nodoc:
|
8
8
|
|
9
9
|
def infinite?
|
10
10
|
false
|
@@ -12,8 +12,6 @@ class Date
|
|
12
12
|
|
13
13
|
class Infinity < Numeric # :nodoc:
|
14
14
|
|
15
|
-
include Comparable
|
16
|
-
|
17
15
|
def initialize(d=1) @d = d <=> 0 end
|
18
16
|
|
19
17
|
def d() @d end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tadayoshi Funaba
|
@@ -30,6 +30,7 @@ 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
36
|
post_install_message:
|