Are there any cons to using Joda-Time?

后端 未结 7 1731
我在风中等你
我在风中等你 2020-12-02 13:12

I want to convince the architecture manager to include the Joda-Time jar in our product.

Do you know any disadvantages in using it?

I think Joda-Time needs t

7条回答
  •  一向
    一向 (楼主)
    2020-12-02 13:34

    In my opinion, the most important drawback in Joda-Time is about precision: many databases store timestamps with microsecond (or even nanosecond) precision. Joda-time goes only to milliseconds. This is not acceptable to me: all "data model" classes that I use need to reflect the full precision of the data in my database. Approximations or truncations of my data by a library just don't cut it.

    Here is the reasoning behind the choice of millisecond precision, taken from the JSR 310 mailing list:

    "Joda-Time chose to use milliseconds as it made conversions to Date and Calendar easier." - S. Colebourne

    Easier for whom? The author of the library, one would assume... Incorrect design decision, in my opinion, when almost all databases store times to microsecond/nanosecond precision. The disregard for database values is worrying.

提交回复
热议问题