[GOODIE] TimeStamp -- why isn't this already in Squeak?

Norton, Chris chrisn at Kronos.com
Thu Oct 12 03:09:24 UTC 2000


Hi Folks!

I was coding furiously the other evening and I needed a TimeStamp, so I
tried to add one to my code and discovered that TimeStamp doesn't exist in
Squeak!  Well, needless to say, I found this to be intolerable so I
implemented it... <grin>

This changeset has been tested on Windows NT 4.0 on Squeak 2.7 (cs 1782) and
on Squeak 2.9a (cs 2774).

Caveat:  

Somebody changed the acceptable string format on Date class>>fromString:
between 2.7 and 2.9a.  Consequentially, one of the examples in the TimeStamp
class comment will not work in Squeak 2.7 "as is".  If you want to try out
the TimeStamp class>>fromString: in Squeak 2.7, try this instead:

TimeStamp fromString: '01/10/2000 11:55:00 am'

All examples of TimeStamp class>>fromString: work with Squeak 2.9a.

Engineering Notes:

*	I added an obvious conversion method to Date
*	I added Time class>>fromString: for polymorphism (symmetry between
Date, Time and TimeStamp)
*	I did not tackle TimeZones.  I'll leave that to another ambitious
Squeaker!  :-)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Change Set:		TimeStamp
Date:			7 October 2000
Author:			Chris Norton

This changeset introduces TimeStamps to Squeak.

There are also some Time and Date methods that were added for completeness.

You'll notice that the #= method mentions Time Zones.  TimeStamp doesn't
currently know about Time Zones, but it probably should in the future.  For
now, I'll leave Time Zones as an exercise for the reader.  :-)

I hope you enjoy TimeStamp!

---==> Chris

 <<TimeStamp.1.cs.gz>> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TimeStamp.1.cs.gz
Type: application/octet-stream
Size: 2087 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20001011/0d183738/TimeStamp.1.cs.obj


More information about the Squeak-dev mailing list