Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Created December 10, 2012 09:42
Show Gist options
  • Save kfatehi/4249617 to your computer and use it in GitHub Desktop.
Save kfatehi/4249617 to your computer and use it in GitHub Desktop.
Datetime difference in p327 v p193
# in ruby19p193 (on mac) we get the expected behavior
[9] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at']
=> Mon, 10 Dec 2012 09:32:21 UTC +00:00
[10] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> left['created_at']
=> Mon, 10 Dec 2012 09:32:21 UTC +00:00
[11] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at'] == left['created_at']
=> true
# in ruby19p327 (on ubuntu)
# with right and left being two seemingly identical hashes:
[13] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at']
=> Mon, 10 Dec 2012 09:35:56 UTC +00:00
[14] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> left['created_at']
=> Mon, 10 Dec 2012 09:35:56 UTC +00:00
[15] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at'] == left['created_at']
=> false
# what? false? why? is it because of usecs?
[17] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> left['created_at'].usec
=> 580168
[18] pry(#<RSpec::Core::ExampleGroup::Nested_1::Nested_2>)> right['created_at'].usec
=> 580168
@kfatehi
Copy link
Author

kfatehi commented Dec 10, 2012

Mystery solved:

[29] pry(#RSpec::Core::ExampleGroup::Nested_1::Nested_2)> right['created_at'].to_f
=> 1355132156.5801682
[30] pry(#RSpec::Core::ExampleGroup::Nested_1::Nested_2)> left['created_at'].to_f
=> 1355132156.580168

@kfatehi
Copy link
Author

kfatehi commented Dec 10, 2012

02:44 love_col_: Radar: elaptics: for the record, i downgraded to p193, and i am still getting that issue, so it had nothing to do with the ruby version
02:44 love_col_: the only remaining variable is that one machine is ubuntu while the other is mac os x
02:44 love_col_: still confused, but i wanted to clear the air regarding my blaming of p327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment