[squeak-dev] Re: Date[And]Time fractional seconds printing

David T. Lewis lewis at mail.msen.com
Fri Aug 20 01:16:56 UTC 2010


On Thu, Aug 19, 2010 at 09:37:39AM -0700, Colin Putney wrote:
> 
> On 2010-08-19, at 4:56 AM, David T. Lewis wrote:
> 
> > I don't know the reason for carrying nanoseconds. With respect to
> > complexity, the nanosecond implementation is no more complex than
> > would be the case for microseconds, and I don't think it has any
> > additional computational penalty, so my guess would be that nanoseconds
> > were chosen in order to provide essentially unlimited precision.
> > 
> > To my mind, the more worthwhile simplification would be to represent
> > time as a magnitude (one number, rather than jdn, seconds, nanos and
> > offset). In other words, keep the protocol for DateAndTime the
> > same but let the underlying representation be a Number of seconds
> > UTC since the epoch. This would simplify time arithmetic (think
> > calculation of duration across a daylight savings time transition),
> > and I suspect that it might help performance, given the heavy use
> > of time stamps in source files, Monticello, etc. But it would
> > be a lot of work to implement this, and I have never gotten around
> > to trying it.
> 
> I've done this. The MDTimestamp class in Monticello 2.x is a subclass
> of Magnitude. Internally it's organized as a 4-byte value representing
> the number of seconds since March 1, 1980. There's also a (slightly
> incomplete) MDTimestampPrinter class that prints timestamps using
> format strings similar to strftime(). The approach worked out quite well.

Colin,

Good to know about this. What aspect of this worked well? Is this
done for performance or for other reasons?

Thanks,
Dave




More information about the Squeak-dev mailing list