class RunTimer::Do_Time

Public Class Methods

timer() click to toggle source
# File lib/run_timer.rb, line 8
def self.timer
  system("clear")

  $time_set = File.read("settings/ticks.txt").strip.to_i
  $wait_sec = File.read("settings/waits.txt").strip.to_i

  $hours   = 0; $minutes = 0; $seconds = 0;

  $time_set.times do
    if $hours   == 60; $hours    = 0; $hours   += 1; end
    if $minutes == 60; $minutes  = 0; $minutes += 1; end
    if $seconds == 60; $seconds  = 0; $seconds += 1; end

    $seconds += 1

    puts "Timer: #{$hours};#{$minutes};#{$seconds}"

    sleep(1)

    system("clear")
  end
end