aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time/calculations.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-07-03 01:39:54 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-07-03 02:13:44 -0300
commit201f373e7a183f33264ae31e7ca66768dddd3ebe (patch)
tree8e37b9e01841bcb9c017b5b40bdcd834866d7b40 /activesupport/lib/active_support/core_ext/time/calculations.rb
parent8cc746331c32a6951e5c73c8a21fd32f00680471 (diff)
downloadrails-201f373e7a183f33264ae31e7ca66768dddd3ebe.tar.gz
rails-201f373e7a183f33264ae31e7ca66768dddd3ebe.tar.bz2
rails-201f373e7a183f33264ae31e7ca66768dddd3ebe.zip
Refactor move some date, time and date_time methods to */zones and fixed some requires
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/calculations.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb5
1 files changed, 5 insertions, 0 deletions
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 <tt>Time.zone.now</tt> when <tt>config.time_zone</tt> is set, otherwise just returns <tt>Time.now</tt>.
+ def current
+ ::Time.zone_default ? ::Time.zone.now : ::Time.now
+ end
end
# Tells whether the Time object's time lies in the past