October 03, 2003

silent but deadly

ran into a nasty issue with dateDiff returning the equivalent of a java Long (32bit int). which is fine if you use dateDiff for years, months, days, etc. however if you want minutes or seconds dateparts and the date difference is large, say the difference in seconds between 1-jan-1970 and 1-feb-2038. your app will silently kill itself, the Long value the dateDiff function returns will quitely wrap to negative. i lost quite a bit of sleep tracking this down for my non-gregorian calendar CFCs (based on icu4j). you can see teh issue quite clearly here. so if you're dealing with small dateparts and large date differences, watch out for this. i have to thank andrew tyrone for first finding the bug in the hebrewCalendarCFC & steven r. loomis for working with me to track down the problem with icu4j.

0 Comments:

Post a Comment

<< Home