Simplifying Date and Time classes

Brent Pinkney Brent at astarte.co.nz
Tue May 23 05:45:51 UTC 2000


Hi,

I have attached a wee changeset which replaces the implementation of Date
and Time.

The Date class has been refactored to use the Julian Day Number
representation internally. I recall the IBM Open Class L:ibrary for C++ did
something similar. It makes manipulation of Dates a lot easier.

I similarly refactored the Time class to store the time as the number of
seconds elapses since midnight.

23 May 2000 = 2451688 JDN so the implementation is a SmallInteger. I cannot
see any performance problems. The motivation for this changeset was a stray
quote to the effect that we now have sufficient computing power to not worry
unneccessarily about performace.

I have confirmed the results agsint
http://www.cs.runet.edu/~dana/java/julian_date/applet.html

A couple of methods have become unused (obsolete ?) 

ANSI stuff:
--------------
I tried my changeset against My Harmon's ANSI SUnit tests and they failed
miserably. The ANSI suite makes some assumptions about the Date class
internals.
I believe that such a refactoring will make the implementation of the
DatAndTime protocols easier.

It will also allow Squak to elegantly support alternative calenders.

 <<DateTimeRefac.1.cs>> 




-------------- next part --------------
A non-text attachment was scrubbed...
Name: DateTimeRefac.1.cs
Type: application/octet-stream
Size: 24658 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000523/e93b5c08/DateTimeRefac.1.obj


More information about the Squeak-dev mailing list