[squeak-dev] About a object life

Edgar J. De Cleene edgardec2005 at gmail.com
Sat Nov 3 17:58:46 UTC 2012




On 11/3/12 4:24 PM, "Hans-Martin Mosner" <hmm at heeg.de> wrote:

> For existing objects, it's impossible to know how old they are.
>  For new objects, you can store a creation timestamp. Since this is very
> dependent on your actual needs, there is probably no ready-to-use code, but
> the functionality is really simple (assuming you have an instance variable
> creationTime):
>  
>  initialize
>      super initialize.
>      creationTime := DateAndTime now.
>  
>  age
>      ^DateAndTime now - creationTime
>  
>  Cheers,
>  Hans-Martin


Well, you confirm my guess.

Very thanks Hans

Edgar




More information about the Squeak-dev mailing list