Why does this expression return false?
(Time.now - 10.hours).utc == Time.now.utc - 10.hours
Why accounts for the difference in the results? And which way is correct?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because they’re not the same. Rubys
Time.nowtracks time to a fraction of a second, the output of#to_sjust doesn’t show that.Check out the documentation for the
Timeclass here.