Issue #12190 has been updated by Akira Tanaka.


I think current Time.parse doesn't match the document.

```
# Since there are numerous conflicts among locally defined time zone
# abbreviations all over the world, this method is not intended to
# understand all of them.  For example, the abbreviation "CST" is
# used variously as:
#
#     -06:00 in America/Chicago,
#     -05:00 in America/Havana,
#     +08:00 in Asia/Harbin,
#     +09:30 in Australia/Darwin,
#     +10:30 in Australia/Adelaide,
#     etc.
#
# Based on this fact, this method only understands the time zone
# abbreviations described in RFC 822 and the system time zone, in the
# order named. (i.e. a definition in RFC 822 overrides the system
# time zone definition.)  The system time zone is taken from
# <tt>Time.local(year, 1, 1).zone</tt> and
# <tt>Time.local(year, 7, 1).zone</tt>.
# If the extracted time zone abbreviation does not match any of them,
# it is ignored and the given time is regarded as a local time.
```

"this method only understands the time zone abbreviations described in RFC 822 and the system time zone" is invalid now.

This causes that more system time zones are overriden.

For example, AST is used by America/Anguilla as -14400 (-04:00) and
Asia/Aden as 10800 (+03:00).

AST is not described in RFC 822.

But ext/date/date_parse.c defines AST as -4*3600 (-04:00).
This means date_parse.c ignores Asia/Aden.

So, people live in Asia/Aden will see following behavior difference
between Ruby 2.3 and Ruby 2.4.

```
% TZ=Asia/Aden ruby-2.3.0 -v -rtime -e 'p Time.parse("2000-01-01 00:00:00 AST")'
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
2000-01-01 00:00:00 +0300
% TZ=Asia/Aden ./ruby -v -rtime -e 'p Time.parse("2000-01-01 00:00:00 AST")'
ruby 2.4.0dev (2016-04-16 trunk 54606) [x86_64-linux]
2000-01-01 00:00:00 -0400
```


----------------------------------------
Bug #12190: DateTime.strptime and Time.strptime does not have compatibility in terms of parsing timezone
https://bugs.ruby-lang.org/issues/12190#change-58148

* Author: Naotoshi Seo
* Status: Closed
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13]
* Backport: 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
For CET, only DateTime.strptime successfully parsed timezone

```
irb(main):003:0> DateTime.strptime('2015-11-12 CET', '%Y-%m-%d %Z')
=> #<DateTime: 2015-11-12T00:00:00+01:00 ((2457338j,82800s,0n),+3600s,2299161j)>
irb(main):004:0> Time.strptime('2015-11-12 CET', '%Y-%m-%d %Z')
=> 2015-11-12 00:00:00 +0900
```

For JST also, only DateTime worked.

```
irb(main):005:0> ENV['TZ'] = 'UTC'
=> "UTC"
irb(main):006:0> DateTime.strptime('2015-11-12 JST', '%Y-%m-%d %Z')
=> #<DateTime: 2015-11-12T00:00:00+09:00 ((2457338j,54000s,0n),+32400s,2299161j)>
irb(main):007:0> Time.strptime('2015-11-12 JST', '%Y-%m-%d %Z')
=> 2015-11-12 00:00:00 +0000
```

For PST, both worked.

```
irb(main):004:0> DateTime.strptime('2015-11-12 PST', '%Y-%m-%d %Z')
=> #<DateTime: 2015-11-12T00:00:00-08:00 ((2457339j,28800s,0n),-28800s,2299161j)>
irb(main):003:0> Time.strptime('2015-11-12 PST', '%Y-%m-%d %Z')
=> 2015-11-12 00:00:00 -0800
```

I felt DateTime.strptime and Time.strptime should have compatibility.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>