Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think that for the vast majority of real-world software applications JodaTime is bloated and unnecessary.

Most applications need only three 'classes' to represent time:

1. A timestamp (ie. number of milliseconds since midnight on 1 January 1970 GMT)

2. A Gregorian Date (ie. three numbers representing day, month, year)

3. A TimeZone (to convert between 1 and 2)

In Java the first and third types are perfectly represented by java.util.Date and java.util.TimeZone. The second class can be represented by something like this: http://calendardate.sourceforge.net/

(Disclaimer: I wrote CalendarDate)



1. A timestamp (ie. number of milliseconds since midnight on 1 January 1970 GMT)

You know that's not unix time, right? Unix time doesn't include leap seconds.


Hmm...I did not know that! I should really have said 'eg.' instead of 'ie.'

The point of the above 'timestamp' is is to represent a specific instant in time, independent of any time zone or calendar system. You can use Unix time for this purpose.


Depends. unixtime is for seconds, if you want to record 2 things that happen ΒΌ second apart, they might have the same value.

Also during leapseconds, unix time does funny things, like 2 second long 'seconds'. or it goes backwards to reset etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: