[squeak-dev] About a object life
hmm at heeg.de
Sat Nov 3 18:24:31 UTC 2012
Am 11/03/2012 03:26 PM, schrieb Edgar J. De Cleene:
> About a object life Folks:
> I wish know how old a object is.
> Any have code for this ?
> Thanks in advance
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):
creationTime := DateAndTime now.
^DateAndTime now - creationTime
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev