Sha256: 230acd8019c2a9c457db924ca95ec07706c7e6af5a6f37c870ffc9d61df096bb

Contents?: true

Size: 740 Bytes

Versions: 1

Compression:

Stored size: 740 Bytes

Contents

require 'date'
require 'time'

require 'third_base'
TimeCrisis = ThirdBase
require 'time_crisis/ext'

require 'time_crisis/tzinfo'
require 'time_crisis/support'
require 'time_crisis/meteorological_seasons'
require 'time_crisis/date_range'
require 'time_crisis/named_months'
require 'time_crisis/weekend'
require 'time_crisis/nth_weekday'
require 'time_crisis/holiday'

module TimeCrisis
  class DateTime
    ENVMUTEX = Mutex.new
    def for_zone(time_zone)
      ENVMUTEX.synchronize do
        original_zone = ENV['TZ']
        begin
          utc_time = self.to_time.utc
          ENV['TZ'] = time_zone
          utc_time.localtime.to_tc_datetime
        ensure
          ENV['TZ'] = original_zone
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
time_crisis-0.2.0 lib/time_crisis.rb