Test to show inconsistency between Time and DateTime

There's a difference with the way activesupports' end_of_[month/day/etc] work for Time and DateTime, as they use different precision (usecs for Time and seconds for DateTime). As usecs are also available on the DateTime class (just not used for end_of_* methods), the result is that a Time.now.end_of_month.to_date_time > DateTime.now.end_of_month

This introduces subtle bugs in applications mixing Time and DateTime.

Possible solutions:

1. We skip miliseconds when changing a Time object to a DateTime, that way we'll keep DateTime's precision as seconds and miliseconds will be always 0.

2. We add milisecond support for end_of_* methods in DateTime, it'd be a more breaking change.


I'd recommend solution 1 and I'm happy to submit a patch if you decide that's indeeed the correct way to solve it.