[Haskell-cafe] threadDelay delays less time than expected (Windows)
Lian Hung Hon
hon.lianhung at gmail.com
Thu Dec 29 13:19:01 UTC 2016
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
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!
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.
> > 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>
> >> Dear Tom/Yitz,
> >> Just tested, returns False. I'm on 64 bit by the way. What should I do
> >> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe