Re: Possible bug in Calendar
- From: Lew <noone@xxxxxxxxxxxxx>
- Date: Thu, 13 Nov 2008 00:24:42 -0500
"Harold Yarmouth" wrote:
That is not a "case in point". Locale-specific rules may be involved in providing the localized user interfaces, including selection of which business rules to apply, but in the core logic classes I *hope* your Dates are all represented in one particular time base and that when the chosen business rules say "x is three days after y" it just adds 3*86400*1000ms to some number somewhere under the hood.
That misconceived calculation, in fact, was the source of the bugs I'm fixing - people erroneously calculated intervals of days by multiplying 24 hours times the number of milliseconds in an hour. Of course, not every calendar day is 24 hours long, at least not in the U.S., Canada, the U.K. and a host of other countries, so a couple of times a year this would return the wrong interval.
"Harold"'s proposed interval calculation is wrong. The advantage of Calendar, in this case GregorianCalendar, for all its flaws, is that it correctly calculates intervals like "three days after y", rather than by such a naive and incorrect means.
Arne Vajhøj wrote:
Nonsense.
People pay bills the 1st every month not at X milliseconds interval.
Or the 15th, or every two weeks, or whatever. Calendar is able to give a reasonable interpretation to "one month after January 31, 2008", not to be confused with "30 days after January 31, 2008".
Some years back I worked on a warehouse project where the client billed their customers according to the number of days their goods were in storage, but also gave special deals as incentives. The deals were things like, "first three days free, not including weekends or holidays".
Calendars are messy, human, psychological phenomena, not pristine mathematical concepts.
--
Lew
.
- Follow-Ups:
- Re: Possible bug in Calendar
- From: Harold Yarmouth
- Re: Possible bug in Calendar
- References:
- Re: Possible bug in Calendar
- From: Harold Yarmouth
- Re: Possible bug in Calendar
- From: Arne Vajhøj
- Re: Possible bug in Calendar
- From: Harold Yarmouth
- Re: Possible bug in Calendar
- From: Arne Vajhøj
- Re: Possible bug in Calendar
- From: Lew
- Re: Possible bug in Calendar
- From: Harold Yarmouth
- Re: Possible bug in Calendar
- From: Arne Vajhøj
- Re: Possible bug in Calendar
- Prev by Date: books
- Next by Date: Re: Possible bug in Calendar
- Previous by thread: Re: Possible bug in Calendar
- Next by thread: Re: Possible bug in Calendar
- Index(es):
Relevant Pages
|