On Mar 5, 6:10 pm, Phil Hagelberg <p...@hagelb.org> wrote:
> Allen Rohner <aroh...@gmail.com> writes:
> > I strongly recommend that you make sure you understand where and why
> > Joda differs from the Java standard lib. If you don't handle the cases
> > that Joda already does, you *will* have bugs.
>
> Interesting. So far everyone I've talked to who recommended Joda did so
> because the built-in Java classes had extremely awkward/limited APIs,
> not because their behaviour was incorrect in some way.
>
> I'm definitely interested in looking into this deeper, but what kind of
> problems have you seen? Timezone-related bugs? Leap year problems?
>
> Perhaps I should look through their test suite.
>
> -Phil

A few links for more proof:

http://www.ociweb.com/jnb/jnbJul2008.html  "As mentioned, one of the
problems with the JDK API is difficulty in calculating the number of
days between two different dates. To learn a bit about how to use Joda
Time, let's see how one can solve that problem a few different ways
using Joda Time. The example finds the number of days from January 1,
2008 to July 1, 2008 ... While this might seem a trivial problem, it
actually is not simple using just the JDK. The typical approach used
with the JDK is to compare the timestamps for the midnights of January
1 and July 1 and divide the result by the number of milliseconds in a
day. While this works in some cases, my computer would give 181.958333
using that approach instead of 182 for the given example. Why? Because
my computer is set to use Daylight Saving Time in the northern
hemisphere, and one hour was skipped in the first half of the year."

http://jcp.org/en/jsr/detail?id=310  This is the JSR for the
replacement of the java date/time libraries. The replacement is being
written by the author of Joda time, largely based on his experience in
Joda time. Section 2.5 of the JSR lists many current problems with the
java std lib time representation.

The javadocs for Date and Calendar are also worth reading:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html

Additionally, the Joda library heavily emphasizes immutable objects.

HTH,

Allen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to