Permalink
Browse files

simpler datetime to time code

  • Loading branch information...
1 parent c8d4bd4 commit 7aa45ecc1c38782a408a7bbae1bf37de5cbb37a0 @archiloque archiloque committed Jul 9, 2011
Showing with 3 additions and 5 deletions.
  1. +2 −4 lib/feedzirra/core_ext/date.rb
  2. +1 −1 lib/feedzirra/feed_entry_utilities.rb
@@ -1,4 +1,4 @@
-# Date code pulled from:
+# Date code pulled and adapted from:
# Ruby Cookbook by Lucas Carlson and Leonard Richardson
# Published by O'Reilly
# ISBN: 0-596-52369-6
@@ -13,9 +13,7 @@ def feed_utils_to_local_time
private
def feed_utils_to_time(dest, method)
- #Convert a fraction of a day to a number of microseconds
- usec = (dest.sec_fraction * 60 * 60 * 24 * (10**6)).to_i
Time.send(method, dest.year, dest.month, dest.day, dest.hour, dest.min,
- dest.sec, usec)
+ dest.sec, dest.zone)
end
end
@@ -9,7 +9,7 @@ def parse_datetime(string)
begin
DateTime.parse(string).feed_utils_to_gm_time
rescue
- puts "DATE CAN'T BE PARSED: #{string}"
+ puts "DATE CAN'T BE PARSED: [#{string}]"
nil
end
end

0 comments on commit 7aa45ec

Please sign in to comment.