[Haskell-cafe] threadDelay delays less time than expected (Windows)
David Turner
dct25-561bs at mythic-beasts.com
Thu Dec 29 14:23:15 UTC 2016
The unbounded-delays package should probably do what you want:
https://hackage.haskell.org/package/unbounded-delays
On 29 Dec 2016 13:29, "Theodore Lief Gannon" <tanuki at gmail.com> wrote:
> The existence of a workaround doesn't make it not a bug! Definitely report
> it anyway. Worst case, the bug is actually in Windows but is now known and
> centrally documented. For that matter, GCH could build the replicateM trick
> into the implementation on a platform-specific basis.
>
> On Dec 29, 2016 5:21 AM, "Lian Hung Hon" <hon.lianhung at gmail.com> wrote:
>
>> Dear Tom,
>>
>> That is a good workaround, now I'm using divMod with the max value of
>> Int, and things are working again :) So it really is because of int
>> overflow somewhere..
>>
>> Since a workaround is available I guess I won't file a bug report yet.
>> Thomas' comment also got me second guessing myself..
>>
>> Thank you everyone for your help and guidance!
>>
>> Regards,
>> Hon
>>
>> On 29 Dec 2016 09:47, <amindfv at gmail.com> wrote:
>>
>>> 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.
>>>
>>
>> _______________________________________________
>> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161229/0b09ad0d/attachment.html>
More information about the Haskell-Cafe
mailing list