time_limit = gets.to_f * 60
start_time = Time.new
end_time = start_time + time_limit
x = 1
until Time.new >= end_time
time_left = end_time - Time.new
time_left_in_minutes = time_left / 60
puts "Minutes Left: #{time_left_in_minutes}"
end
until x == 0
puts "Time Since End of #{time_limit / 60} Minutes: #{Time.new - end_time}"
end
我的电脑风扇全速旋转,我的电脑在运行此代码时变得嘈杂。有没有更好的方法来做到这一点,而不是为处理器做太多的工作?