[ENH] accurateDateAndTimeNow-avi - reject

Lex Spoon lex at cc.gatech.edu
Tue Mar 16 15:40:04 UTC 2004


> > I thought monotonicity meant that (DateAndTime now) >= (DateAndTime now)
> > would always be true. In other words, "DateAndTime now" considered as
> > a function wo elimiated the would always be non-decreasing.
> 
> That is what it means.

You seem to disagree -- you seem to be talking about "strict"
monotanicity, which means the function is always increasing, as opposed
to always non-decreasing.


> > As Avi points out elsewhere, if you evaluate "DateAndTime now" faster
> > than the resolution of the clock, you should get the same value.
> 
> Aye, that is why my original implementation kept track of the last 
> instance of DateAndTime instanciated by DateAndTime class>>#now and 
> advanced it by one nano-second if the evaluation occured faster than the 
> milli-second clock resolution.
> 
> Regrettably the rest of the #now method was very broken. Avi fixed it but 
> took out the montonic functionality.

Why do you want that functionality?  It sounds like a bad idea to me. 
If you really want *strict* monotonicity, then you can add a counter
instead of or in addition to the time stamp.

With the nanosecond bumps:

	1. You get behavior that is not portable to other Smalltalks.
	
	2. You lose all monotonicity guarantees, strict and non-strict, with
other programs on the computer Squeak is running on.

	3.You lose precision in the timings if you call the function many
thousands of times per second.  (You can't do that right now, but you
could on an OS where the time functions are not system calls.)
	
	4. You can actually lose all monotonicity guarantees *within Squeak*,
if you manage to call the function over one million times per second.

	5. It's weird.
	
	
To be honest, #5 is the real motivation for me.  :)


-Lex



More information about the Squeak-dev mailing list