From 201f373e7a183f33264ae31e7ca66768dddd3ebe Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 3 Jul 2010 01:39:54 -0300 Subject: Refactor move some date, time and date_time methods to */zones and fixed some requires --- activesupport/lib/active_support/core_ext/time/calculations.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/lib/active_support/core_ext/time/calculations.rb') diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 3c218d88e5..90b6cd3685 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -40,6 +40,11 @@ class Time def local_time(*args) time_with_datetime_fallback(:local, *args) end + + # Returns Time.zone.now when config.time_zone is set, otherwise just returns Time.now. + def current + ::Time.zone_default ? ::Time.zone.now : ::Time.now + end end # Tells whether the Time object's time lies in the past -- cgit v1.2.3