KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to use a Time object as a int (TimeObject.to_i) Then i need to convert a int back to a Time, to compare against the original Time. Short Example t1 = Time.now t2 = Time.at(t1.to_i) puts t1 == t2 # Says False puts t1.eql?(t2) # Says False Why this says its false ? When i print both Time objetcs shows the same thing D: puts t1 #shows : 2012-01-06 16:01:53 -0300 puts t2 #shows : 2012-01-06 16:01:53 -0300 puts t1.to_a.to_s #shows : [ 53, 1, 16, 6, 1, 2012, 5, 6, true, "CLST"] puts t2.to_a.to_s #shows : [ 53, 1, 16, 6, 1, 2012, 5, 6, true, "CLST"] they are the same thing D: but when trying to compare with == or eql? says they are diferent (sorry for my bad english)
Tags (comma-separated)
Save Edits
Cancel