Minor bug in 'wait_valid()' #24

Closed
jonathn opened this Issue Mar 23, 2013 · 0 comments

Comments

Projects
None yet
2 participants
@jonathn

jonathn commented Mar 23, 2013

wait_valid(infinity, _Timeout) ->
    true;
wait_valid(StartTime, Timeout) ->
    Waited = timer:now_diff(os:timestamp(), StartTime),
    (Waited div 1000) < Timeout.

In the first line, I believe infinity should be matching the Timeout and not the StartTime.
Interestingly, this bug goes unnoticed because (Waited div 1000) < Timeout actually works as expected when Timeout is the atom infinity due to Erlang term sort-ordering rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment