aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time/compatibility.rb
blob: 63ac4c2f3a9015b8c88a378a285eb64d2e1d3d44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require 'active_support/core_ext/date_and_time/compatibility'

class DateTime
  prepend DateAndTime::Compatibility

  # Returns a <tt>Time.local()</tt> instance of the simultaneous time in your
  # system's <tt>ENV['TZ']</tt> zone.
  def getlocal(utc_offset = nil)
    utc = getutc

    Time.utc(
      utc.year, utc.month, utc.day,
      utc.hour, utc.min, utc.sec + utc.sec_fraction
    ).getlocal(utc_offset)
  end
end