[poe-commits] SF.net SVN: poe: [1938] trunk/poe/lib/POE/Kernel.pm
Brought to you by:
rcaputo
From: <ada...@us...> - 2006-04-11 10:07:14
|
Revision: 1938 Author: adamkennedy Date: 2006-04-11 03:06:53 -0700 (Tue, 11 Apr 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=1938&view=rev Log Message: ----------- Whenever you work with relative time, you have to measure "now" absolutely as soon as possible. Moved the time() call from when delay_set sets the actual alarm to the very top, which is much closer to where the caller meant "now" to mean. Modified Paths: -------------- trunk/poe/lib/POE/Kernel.pm Modified: trunk/poe/lib/POE/Kernel.pm =================================================================== --- trunk/poe/lib/POE/Kernel.pm 2006-04-10 23:36:15 UTC (rev 1937) +++ trunk/poe/lib/POE/Kernel.pm 2006-04-11 10:06:53 UTC (rev 1938) @@ -1938,6 +1938,12 @@ # Time::HiRes'. sub delay_set { + # Always always always grab time() ASAP, so that the eventual + # time we set the alarm for is as close as possible to the time + # at which they ASKED for the delay, not when we actually set it. + my $t = time(); + + # And now continue as normal my ($self, $event_name, $seconds, @etc) = @_; if (ASSERT_USAGE) { @@ -1966,7 +1972,7 @@ return $self->_data_ev_enqueue ( $kr_active_session, $kr_active_session, $event_name, ET_ALARM, [ @etc ], - (caller)[1,2], $kr_active_event, time() + $seconds, + (caller)[1,2], $kr_active_event, $t + $seconds, ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |