Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Windows / Linux puzzler

by haukex (Bishop)
on Mar 23, 2020 at 07:48 UTC ( #11114564=note: print w/replies, xml ) Need Help??


in reply to Re^2: Windows / Linux puzzler
in thread Windows / Linux puzzler

I like your first suspicion more than your second.

Sorry, but personally I find the AM's first suggestion less likely, time should be portable across platforms, and it being off by an entire minute would be an obvious problem. I do think you should investigate the values of your variables on both platforms though: output them via Data::Dumper with $Data::Dumper::Useqq=1; or Data::Dump (see also the Basic debugging checklist).

Replies are listed 'Best First'.
Re^4: Windows / Linux puzzler
by jcb (Priest) on Mar 23, 2020 at 21:57 UTC
    being off by an entire minute would be an obvious problem

    It does not have to be off by an entire minute to cause this type of problem. A few milliseconds would be enough if the code we see is only run once per minute to check if any emails should be sent. If I understand correctly, between greater timing accuracy and a more efficient scheduler, the code could be seeing "10.03" minutes in Windows and "9.97" minutes (then "10.96" when the email is sent "11 minutes later") in Linux.

Re^4: Windows / Linux puzzler
by lbrandewie (Acolyte) on Mar 23, 2020 at 20:29 UTC

    Rather than dumping everything, I modded the code to print out the quantities being compared. More testing required. I'll get back to you. Thanks,

    Lars

Re^4: Windows / Linux puzzler
by lbrandewie (Acolyte) on Mar 24, 2020 at 06:44 UTC

    I was able to rule out time as the joker in the deck, if only because we're dealing with an interval of time, not the time of some event. Thus it shouldn't matter if time() returns different values on the two systems.

      The suggestion by haukex in 11114564 can be followed more thoroughly. Dump each variable and partial step involved in the calculation to track what happens. This means $min, $squelch, ($min - $squelch), and so forth. It is probably worth printing them at a higher precision than the default to see more, e.g. printf "%.17f\n", ($min - $squelch) (although both those should be integers based on the original post).

      Although, "should be integer" depends what you have done with the numbers. Does your code use $min or $squelch in a floating point context? This could cause them to be used as floats in later calcs. I'm not overly familiar with the internals, though, so cannot say what to expect with any confidence.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11114564]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2020-07-08 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?