[squeak-dev] The Inbox: Chronology-Core-ul.54.mcz

David T. Lewis lewis at mail.msen.com
Tue May 5 02:57:53 UTC 2020


On Mon, May 04, 2020 at 04:39:41PM +0200, Levente Uzonyi wrote:
> Hi Marcel,
> 
> On Mon, 4 May 2020, Marcel Taeumel wrote:
> 
> >Hi Levente!
> >+1
> >
> >Just curious: There is??DaysInMonth ... where is LeapDaysInMonth ? That 
> >fixed 28 seems suspicious... :-)
> 
> I did not change that code. It only appears in the diff because it's not 
> the last statement of that method anymore.
> So, I don't know how leap days are handled, but if it worked before, 
> it'll still work.
> 

Oh well, don't worry too much amount the number of days in February. Even
if we get that right, we will still have to figure out the days in some
other months. Here in Michigan, we had approximately 30.96 days in the month
of March this year.

  "First load TZ-Olson from SqueakMap"
  april := DateAndTime year: 2020 month: 4 day: 1 hour: 0 minute: 0 second: 0 inTimeZoneNamed: 'America/Detroit'.
      "==> 2020-04-01T00:00:00-04:00"
  march := DateAndTime year: 2020 month: 3 day: 1 hour: 0 minute: 0 second: 0 inTimeZoneNamed: 'America/Detroit'.
      "==> 2020-03-01T00:00:00-05:00"
  monthOfMarch := april - march. "==> 30:23:00:00"
  daysInMonthOfMarch := (monthOfMarch asSeconds / (3600 * 24)). "==> (743/24)"
  daysInMonthOfMarch asFloat.  "==> 30.958333333333332"

After we get that sorted out, we can work on the number of seconds in
an hour whenever a leap second is declared.

;-)


But to be serious, the 28 days in February is used in Month class>>daysInMonth:forYear:
which checks Year class>>isLeapYear. These are Brent's original methods, and are
correct for any year ranges that we might reasonably be interested in using.

Dave



More information about the Squeak-dev mailing list