lib/progress/class_methods.rb in progress-3.5.2 vs lib/progress/class_methods.rb in progress-3.6.0
- old
+ new
@@ -1,8 +1,10 @@
# encoding: UTF-8
# frozen_string_literal: true
+require 'progress/elapsed_time'
+
class Progress
# Class methods of Progress
module ClassMethods
def self.extended(klass)
klass.instance_variable_set(:@lock, Mutex.new)
@@ -163,17 +165,17 @@
def restart_beeper
@beeper.restart if @beeper
end
def time_to_print?
- !@next_time_to_print || @next_time_to_print <= Time.now
+ !@next_time_to_print || @next_time_to_print <= ElapsedTime.now
end
def print_message(options = {})
force = options[:force]
lock force do
if force || time_to_print?
- @next_time_to_print = Time.now + 0.3
+ @next_time_to_print = ElapsedTime.now + 0.3
restart_beeper
io << message_for_output(options)
end
end
end