[Pharo-dev] DateAndTime vs TimeStamp

Sven Van Caekenberghe sven at stfx.eu
Sun Nov 10 06:24:32 EST 2013


Related to https://pharo.fogbugz.com/f/cases/2919/should-remove-TimeStamp

Independent from the actual name (TimeStamp/Timestamp is shorter), it is confusing to have the two. TimeStamp inherits from DataAndTime and adds only the following:

(1) its #printOn: is different
(2) its class side #readFrom: matches this
(3) its nanoseconds get set to zero on creation
(4) it has some additional API ([plus|minus][Days|Seconds]:)
(5) it has some alias methods (date, time)

TimeStamp seems to be primarily used to deal with method timestamps. [A]

Now, (1) and (2) for its primary usage [A] could easily be moved to DateAndTime.
(3) is questionable and could be solved by #rounded, if really needed.
(4) is plain silly
(5) is dangerous, the originals are better

So instead of moving API from TimeStamp to its superclass DataAndTime, I would remove it ;-)

Comments ?

Sven

PS: Zinc did use TimeStamp in some places, but replacing all occurrences by DateAndTime had no effect, they are equivalent.





More information about the Pharo-dev mailing list