Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time#zone returns the time zone used for time FAILED Expected "+03" to equal "AST" #385

Closed
AlexWayfer opened this issue Mar 6, 2017 · 6 comments

Comments

@AlexWayfer
Copy link
Contributor

Hello!

What is wrong?

$ ruby -v /home/alex/Projects/ruby/mspec/bin/mspec-run core/time
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
                                                                                            
1)
Time#zone returns the time zone used for time FAILED
Expected "+03"
 to equal "AST"

/home/alex/Projects/ruby/spec/core/time/zone_spec.rb:8:in `block (4 levels) in <top (required)>'
/home/alex/Projects/ruby/spec/core/time/zone_spec.rb:7:in `block (3 levels) in <top (required)>'
/home/alex/Projects/ruby/spec/core/time/zone_spec.rb:3:in `<top (required)>'
[/ | ==================100%================== | 00:00:00]      1F      0E

Finished in 0.077151 seconds

62 files, 503 examples, 9514 expectations, 1 failure, 0 errors, 0 tagged

Arch Linux:

$ uname -a
Linux Alex-ArchMainPC 4.9.11-1-ARCH #1 SMP PREEMPT Sun Feb 19 13:45:52 UTC 2017 x86_64 GNU/Linux

Europe/Moscow:

$ timedatectl 
      Local time: Tue 2017-03-07 00:06:43 MSK
  Universal time: Mon 2017-03-06 21:06:43 UTC
        RTC time: Mon 2017-03-06 21:06:44
       Time zone: Europe/Moscow (MSK, +0300)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no

Ruby 2.4.0:

$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
@eregon
Copy link
Member

eregon commented Mar 6, 2017

The code is

# Testing with Asia/Kuwait here because it doesn't have DST.
with_timezone("Asia/Kuwait") do
Time.now.zone.should == "AST"
end

So I guess your system timezone information does not know the Asia/Kuwait zone?

@AlexWayfer
Copy link
Contributor Author

@eregon I also thought so, but…

$ cat /usr/share/zoneinfo/Asia/Kuwait 
TZif2������6��+�*0�LMT+03TZif2����������6��+�*0�LMT+03
<+03>-3

@eregon
Copy link
Member

eregon commented Mar 6, 2017

I have a slightly different version of that file:

cat /usr/share/zoneinfo/Asia/Kuwait  
TZif2������6��+�*0�LMTASTTZif2����������6��+�*0�LMTAST
AST-3

So it looks like yours does not have the AST shortname in it.

Maybe we should just use America/New_York => 'EST' for everything, would that work on your system?

@eregon eregon closed this as completed in b0de2aa Mar 6, 2017
@eregon
Copy link
Member

eregon commented Mar 6, 2017

@AlexWayfer I pushed a fix, could you check it works for you?
Thank you for the report!

@AlexWayfer
Copy link
Contributor Author

@eregon Everything is perfect, thanks!

@nobu
Copy link
Member

nobu commented Mar 12, 2017

Wow, has USA abolished DST?:tada:

eregon added a commit that referenced this issue Mar 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants