[VW 7.7 bug] #now with subclass of Timestamp

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[VW 7.7 bug] #now with subclass of Timestamp

Paul Baumann

Create a subclass of Timestamp and send it #now. You'll get an instance of Timestamp instead of the subclass you've requested an instance of.

 

Here is code from VW 7.7:

 

Timestamp class>>now

                "Answer a Timestamp for the current local time."

                "Timestamp now"

 

                | timezone milliseconds |

                milliseconds := Time millisecondClockValue.

                timezone := TimeZone default.

                ^(timezone universalToLocal: (timezone secondsToTimestamp: (milliseconds // 1000)))

                                millisecond: milliseconds \\ 1000;

                                yourself

 

The timezone is used as a factory without provision for double-dispatch. Here is code that works prior to VW 7.7:

 

Timestamp class>>now

                "Answer a Timestamp for the current local time."

                "Timestamp now"

 

                ^super new setFromMicroseconds: Time microsecondClock

 

Here is a workaround that works for me:

 

CpTimestamp class>>now

                "VW 7.7 answers instances of Timestamp instead of the class requested.

                 This is a workaround for that problem. -plb 2010.09.29"

                ^super now changeClassTo: CpTimestamp



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange, Inc. (ICE), its subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc