I’ve been pulling my hair out trying to work with Time in Rails. Basically I need to set all time output (core as well as ActiveSupport) to the server’s local time — no GMT, no UTC, etc. I’ve seen various posts relating to Time, but they usually involve someone’s need to set it for each user. Mine isn’t nearly as complex, I simply want consistency when I use any Time object. (I’d also appreciate not receiving errors every 3 seconds telling me that I can’t convert a Fixnum (or some other type) to string — it’s Ruby, just do it!)
I also seem to be getting drastically different times for Time.new vs the ActiveSupport 1.second.ago. Anyway, does anyone have any quality suggestions as regards working with Time in Rails?
If you just want Time objects to be consistent, then why not stick with UTC? I just tried
Time.newand1.second.agousing script/console and I get the same output (give or take a second for typing the command). How are you doing it?