3 ms·
DateTime might also handle leap seconds, time zones, and daylight savings better in general, including future dates. I don't know Time's capabilities, but DateT
by peterwwillis 11y ago
DateTime might also handle leap seconds, time zones, and daylight savings better in general, including future dates. I don't know Time's capabilities, but DateTime will also handle dates past 2036 on any architecture, which is useful when processing expiration dates for SSL certificates, for example. Handling of past dates and times is also important when doing log processing, data archiving, etc.
If you need date/time precision, use DateTime.
- pixeltrix 11y agoNope, Time handles all those things better since Ruby 1.8.7/1.9.3 when it gained support date/times into the far future. Until then it was liable to the Year 2038 problem: http://en.wikipedia.org/wiki/Year_2038_problem http://en.wikipedia.org/wiki/Year_2038_problem
- peterwwillis 11y agoLooking into it further, apparently neither Time nor DateTime account for leap seconds (though they support a 60th second), and only the Time class seems to support daylight savings, according to the docs. So that's pretty weird.