core_ext adds a to_time method to Date, which constructs a new Time object from the Date's year, month and day. DateTime extends Date, and therefore also inherits the to_time method. Unfortunately the hour, minute and second aren't passed to the Time constructor even though they are available. The patch fixes this by checking if self responds to :hour. If it does, it is assumed to also respond to :min and :sec, and a Time object is returned containing all of that info. If it doesn't respond to :hour the code is the same as before the patch.
Without the patch, distance_of_time_in_words etc. is also broken as it calls to_time on the date parameter, which loses the time information. e.g. if I use time_ago_in_words(DateTime.now) (it is currently 15:04 BST) it will return "about 15 hours" rather than the expected "less than a minute".
Before patch:
>> d = DateTime.now
=> #<DateTime: 212021720810911099/86400000000,1/24,2299161>
>> d.to_time
=> Mon Aug 07 00:00:00 BST 2006
>> d.to_s
=> "2006-08-07T15:26:50+0100"
After patch:
>> d = DateTime.now
=> #<DateTime: 42404344549457039/17280000000,1/24,2299161>
>> d.to_time
=> Mon Aug 07 15:59:07 BST 2006
>> d.to_s
=> "2006-08-07T15:59:07+0100"