class Date

Date code pulled and adapted from: Ruby Cookbook by Lucas Carlson and Leonard Richardson Published by O’Reilly ISBN: 0-596-52369-6

Public Instance Methods

feed_utils_to_gm_time() click to toggle source
# File lib/feedjira/core_ext/date.rb, line 8
def feed_utils_to_gm_time
  feed_utils_to_time(new_offset, :gm)
end
feed_utils_to_local_time() click to toggle source
# File lib/feedjira/core_ext/date.rb, line 12
def feed_utils_to_local_time
  feed_utils_to_time(new_offset(DateTime.now.offset - offset), :local)
end

Private Instance Methods

feed_utils_to_time(dest, method) click to toggle source
# File lib/feedjira/core_ext/date.rb, line 18
def feed_utils_to_time(dest, method)
  # Convert a fraction of a day to a number of microseconds
  usec = (dest.sec_fraction * (10**6)).to_i
  Time.send(method, dest.year, dest.month, dest.day, dest.hour, dest.min, dest.sec, usec)
end