lib/polling/engine.rb in polling-0.1.1 vs lib/polling/engine.rb in polling-0.1.2
- old
+ new
@@ -41,10 +41,18 @@
rescue => ex
$stderr.puts ex.to_s
return opts[:init_time]
end
+ def stime_async opts={}
+ stime = opts[:interval] - (opts[:after] - opts[:before])
+ debug debug: opts[:debug], stime: stime
+ stime
+ rescue => ex
+ $stderr.puts ex.to_s
+ end
+
private
def target target=@target, offset=@offset
target + offset
end
@@ -57,9 +65,14 @@
target - now
end
def decrement! init_time=@init_time
@target -= init_time
+ end
+
+ def start_print stime
+ until_time = Time.at(Time.now.to_f + stime)
+ $stdout.print "start: #{until_time}\n"
end
def debug opts={}
if opts[:debug]
until_time = Time.at(Time.now.to_f + opts[:stime])