In Rails, I'm a little confused on the guidance between when to use DateTime.now.utc and Time.current. There seem to be differing opinions inside the framework about which is best, particularly in different versions.
It looks like DateTime.now.utc
produces a timestamp with a UTC offset of zero, while Time.current.utc
produces a timestamp with a time zone of UTC. That seems like a subtle distinction but it's pretty important in many cases (e.g. DST calculations).
When should you use DateTime.now.utc
, and when should you use Time.current.utc
? Is there any reason to use DateTime.now.utc
instead of Time.current.utc
?