Skip to content

Commit

Permalink
do not round up 0
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 18, 2015
1 parent 2705bd3 commit d47d263
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/microhttpd.pl
Expand Up @@ -38,6 +38,7 @@
EOF

# Start event loop
Mojo::IOLoop->recurring(1 => sub { });
local $SIG{INT} = local $SIG{TERM} = sub { Mojo::IOLoop->stop };
Mojo::IOLoop->start;

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Reactor/Poll.pm
Expand Up @@ -35,7 +35,7 @@ sub one_tick {
# Calculate ideal timeout based on timers and round up to next millisecond
my $min = min map { $_->{time} } values %{$self->{timers}};
my $timeout = defined $min ? $min - steady_time : 0.5;
$timeout = $timeout < 0 ? 0 : int($timeout * 1000) + 1;
$timeout = $timeout <= 0 ? 0 : int($timeout * 1000) + 1;

# I/O
if (keys %{$self->{io}}) {
Expand Down

0 comments on commit d47d263

Please sign in to comment.