aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time/calculations.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-07-03 12:46:38 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-07-03 12:46:38 -0700
commit070c24232f74c75b60757ff2bd3cc00ea662d5a6 (patch)
tree7d5c5c3635571fcfd06144f2dff7057e470105b3 /activesupport/lib/active_support/core_ext/time/calculations.rb
parent54250a5bfe6992afaaca6357d3b414e6c49651ba (diff)
parent075f8b72418f2d2ce9c2038bd57139955f6e46ec (diff)
downloadrails-070c24232f74c75b60757ff2bd3cc00ea662d5a6.tar.gz
rails-070c24232f74c75b60757ff2bd3cc00ea662d5a6.tar.bz2
rails-070c24232f74c75b60757ff2bd3cc00ea662d5a6.zip
Merge remote branch 'spastorino/master'
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