Squeak
  QotD    "To be or not to be" – Shakespeare
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
TimeStamp
Last updated at 6:35 pm UTC on 3 April 2018
Do not use this class.

Levente Uzonyi Mon, Apr 2, 2018 at 5:59 PM
Reply-To: The general-purpose Squeak developers list
To: The general-purpose Squeak developers list
Reply | Reply to all | Forward | Print | Delete | Show original
Don't use TimeStamp. I see several issues which break your snippet:
1) #printOn: and #storeOn: ignore time zone information (offset).
2) Class side #readFrom: ignores time zone information (offset).
3) Class side #readFrom: can not fully parse the output of #storeOn:. It seems to only work by accident.
4) It's a subclass of DateAndTime, but it seems to add noting generally useful. Based on the class comment, it has the same purpose as DateAndTime, but that's not the case.

So, use DateAndTime instead:

 t1 := DateAndTime now.
 s := String streamContents: [:stream | t1 storeOn: stream ].
 t2 := Compiler evaluate: s.
 { t1 offset. t2 offset. t1 = t2 } "==> {0:02:00:00 . 0:02:00:00 . true}"

Levente