[Haskell-cafe] threadDelay delays less time than expected (Windows)

amindfv at gmail.com amindfv at gmail.com
Thu Dec 29 02:47:33 UTC 2016


If their supplied code sample is failing, couldn't that indicate a bug in the Windows threadDelay implementation for very large values?

Hon: if you're looking for a short-term solution you can always:

replicateM 48 $ threadDelay $
   (half an hour)

This way you only have to wait half an hour to be sure there's no overflow or incorrect timing.

Tom


> El 28 dic 2016, a las 18:47, Thomas DuBuisson <thomas.dubuisson at gmail.com> escribió:
> 
> Not to be infuriating, but I think you should check and re-check your
> tooling is not using 32 bit values at any particular point.
> 
> Notice:
> 
> (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is
> your observation.  Any time you depend on `Int` to represent numbers
> near or greater than 2^28, or perhaps 2^31 in practice, you should
> think hard about bounds and implications regarding portability anyway.
> 
> -Thomas
> 
>> On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon <hon.lianhung at gmail.com> wrote:
>> Dear Tom/Yitz,
>> 
>> Just tested, returns False. I'm on 64 bit by the way. What should I do from
>> here?
>> 
>> Regards,
>> Hon
>> 
>> 
>>> On 29 Dec 2016 03:47, "Yitzchak Gale" <gale at sefer.org> wrote:
>>> 
>>> Tom wrote:
>>>> (86400000000 :: Integer) > (fromIntegral (maxBound :: Int))
>>>> 
>>>> If True, your machine (32-bit?) is probably overflowing the Int
>>> 
>>> Good point. Even if False on Lian's Windows machine, it could
>>> be there is some 32-bit value somewhere in the Windows
>>> implementation that causes this.
>>> 
>>> Yitz
>> 
>> 
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.


More information about the Haskell-Cafe mailing list