Socket>>#waitForDataFor:ifClosed:ifTimedOut: large delay hangs
David T. Lewis
lewis at mail.msen.com
Wed Jan 16 03:05:06 UTC 2008
On Tue, Jan 15, 2008 at 01:54:29PM -0500, squeakdev1 at reider.net wrote:
> The trick is to come up with a robust implementation of
> absoluteMillisecondClockValue. My previous idea, (Time
> millisecondsSince:0) was wrong; it is equivalent to just (Time
> millisecondClockValue). Maybe something like:
> | last next wrap |
> wrap := SmallInteger maxVal. "is this correct?"
> last := LastAbsoluteMillisecondClockValue ifNil:. "class var"
> next := Time millisecondClockValue .
> [next < last ] whileTrue:[ next := next + wrap].
> next < last ifTrue:[ next := last + (wrap - (last \\ wrap)) + next]."
> ^LastAbsoluteMillisecondClockValue := next
No, nothing like this is going to work reliably. Squeak VMs report clock
values converted to local time, which means that anything you come up
with is going to break horribly on daylight savings transitions. Furthermore,
the clock rollover rules are not necessarily the same on different VMs and
operating systems. The solution (a primitive reporting UTC ticks plus DST
offset) is straightforward and was proposed by Lex Spoon many years ago,
but never attracted much interest.
More information about the Squeak-dev