3 ms·
I think that for the vast majority of real-world software applications JodaTime is bloated and unnecessary. Most applications need only three 'classes' to repr
by MarkMc 14y ago
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/ http://calendardate.sourceforge.net/
(Disclaimer: I wrote CalendarDate)
- rmc 14y ago1. 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.
- MarkMc 14y agoHmm...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.
- rmc 14y agoDepends. 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.