10000 Timezone problem when calling Timecop.freeze at v0.5.8 · Issue #63 · travisjeffery/timecop · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Timezone problem when calling Timecop.freeze at v0.5.8 #63

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

Closed
kyanny opened this issue Jan 9, 2013 · 5 comments
Closed

Timezone problem when calling Timecop.freeze at v0.5.8 #63

kyanny opened this issue Jan 9, 2013 · 5 comments

Comments

@kyanny
Copy link
kyanny commented Jan 9, 2013

At v0.5.8, Timecop.freeze has timezone issue (similar to #57)

[55] pry(main)> require 'timecop'
[57] pry(main)> require 'active_support/all'                                                                        

[58] pry(main)> Time.zone
=> (GMT+09:00) Tokyo
[59] pry(main)> Time.now
=> 2013-01-09 22:28:16 +0900
[60] pry(main)> Timecop.freeze(Time.now)
=> 2013-01-10 07:28:16 +0900

It seems that 68ec6ad occurs this issue.
I think the behaviour removed at 68ec6ad#L0R60 was neccessary.

Since it's the timezone matter problem, running rake test also failed on my laptop. My timezone is Asia/Tokyo (+09:00).

Run options: 

# Running tests:

.......................F..

Finished tests in 0.342019s, 76.0192 tests/s, 181.2765 assertions/s.

  1) Failure:
test_timezones(TestTimeStackItem) [time_stack_item_test.rb:191]:
<Thu, 27 Dec 2012 05:12:12 CET +01:00> expected but was
<2012-12-27 14:12:12 +0900>.

26 tests, 62 assertions, 1 failures, 0 errors, 0 skips
Run options: 

# Running tests:

...........................................

Finished tests in 0.525874s, 81.7686 tests/s, 209.1756 assertions/s.

43 tests, 110 assertions, 0 failures, 0 errors, 0 skips
Run options: 

# Running tests:

.

Finished tests in 0.007542s, 132.5908 tests/s, 132.5908 assertions/s.

1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
Run options: 

# Running tests:

........

Finished tests in 0.505886s, 15.8138 tests/s, 59.3019 assertions/s.

8 tests, 30 assertions, 0 failures, 0 errors, 0 skips
@ghost
Copy link
ghost commented Jan 9, 2013

Just saw this issue with Timecop.travel:

[1] > Time.now
=> 2013-01-08 21:55:09 -0700
[2] > Timecop.travel(1.hour.ago) { Time.now }
=> 2013-01-08 12:55:46 -0700

I just updated Timecop from 0.5.3 to 0.5.8

@ghost
Copy link
ghost commented Jan 9, 2013

This does not occur in 0.5.7:

[1] > Time.now
=> 2013-01-08 21:58:31 -0700
[2] > Timecop.travel(1.hour.ago) { Time.now }
=> 2013-01-08 20:58:32 -0700
[3] > Timecop.freeze(1.hour.ago) { Time.now }
=> 2013-01-08 20:58:44 -0700

@travisjeffery
Copy link
Owner

Ah! I had seen that problem before and just didn't write a test to cover it at the time. Got a test in there now to cover this now though so to it won't happen again.

Fixed in v0.5.9 which I just released.

@kyanny
Copy link
Author
kyanny commented Jan 9, 2013

Thank you for your very quick fix.

Well, maybe you forgot to upgrade version number at https://github.com/travisjeffery/timecop/blob/master/lib/timecop/version.rb to 0.5.9?
It seems that v0.5.9 does not available on rubygems.org https://rubygems.org/gems/timecop/versions

travisjeffery pushed a commit that referenced this issue Jan 9, 2013
@travisjeffery
Copy link
Owner

@kyanny whoops, you're right. It's up there now for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0